【问题标题】:problems with the email body, appearing special characters in emails电子邮件正文出现问题,在电子邮件中出现特殊字符
【发布时间】:2010-04-22 21:07:13
【问题描述】:

当我发送邮件时,我的电子邮件正文出现了一些问题

我在我的网站中使用 php。

我的网站是一个西班牙网站,每当我发送邮件时,邮件中都会出现一些特殊字符。

总是有一个!在那封邮件中标记,也在同一个地方

下面是我正在使用的代码和我收到的电子邮件。

代码

$domain="http://international.com/";

    $subject = "Iinternational :Solicitud de cotización ";

    $subject = mb_convert_encoding($subject, "UTF-8","AUTO");

    $subject = mb_encode_mimeheader($subject);

    $mail_body ="<table width='719' border='0' align='center'>";

    $mail_body .="<tr><td><a href='".$domain."' target='blank' ><img src='".$domain."images/international_s_01.jpg' border='0' width='719'  style='border-color=#c8ceae'  /></a></td></tr>";

    $mail_body .="<tr><td style='padding-left:5px;'><font face='Verdana' size='1px;' color='#6699CC'>Estimado ".$frm_name.",</font></td></tr>";

    $mail_body .="<tr><td height='30' align='center' style='padding-left:5px; font-family:Georgia, Times New Roman, Times, serif; color:#006699; font-weight:bold;font-size:20px;'><u>Solicitud de cotización de Información</u></td></tr>";
    $mail_body .="<tr><td align='center'><table border='1' width='690' cellpadding='0' cellspacing='0' bordercolor='#800040'><tr><td><table border='0' width='690' cellpadding='0' cellspacing='0'>";

    $mail_body .="<tr height='30'><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre del producto</td><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre de la subcategoría</td><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre de la categoría</td></tr>";

    $mail_body .="<tr><td align='left' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$product_name."</td><td style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$sub_category_name."</td><td style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$category_name."</td></tr>";

    $mail_body .="</table></td></tr></table></td></tr>";

    $mail_body .="<tr><td height='30' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;' >Gracias<br>Por visitar nuestro sitio y enviarnos su solicitud. Su información de contacto es segura y no será compartida con nadie.<br>Nos pondremos en contacto con usted dentro de 24 horas.</td></tr><tr><td height='20' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#6699CC;font-weight:bold;font-size:15px;padding-left:5px;' ><FONT face=tahoma color=#000000 size=2><a href='".$domain."'>www. international.com</a></font></td></tr>";

    $mail_body .="<tr><td height='3'></td></tr></table>";
    //$headers = "From: ".$mail_from."\n";

    $mail_body = mb_convert_encoding($mail_body, "UTF-8","AUTO");
    mb_language("es");

    $headers .= "X-Mailer: PHP/" . phpversion()."\n"; // mailer
    $headers .= "From: " ."".mb_encode_mimeheader (mb_convert_encoding($mail_from,"UTF-8","AUTO")) ."" ."<".$mail_from."> \n";

    $headers .= "Content-Type: text/html; charset=UTF-8";// Mime type////charset=UNICODE-1-1-UTF-8
    //$headers .= "Reply-To: ". $email."\n";  // Return path for errors
        //$headers .= "Content-Transfer-Encoding: 16bit\n";

            $success=mail($mail_to, $subject, $mail_body, $headers);
    $sucess_flag_user = 1;//sent the mail and set the sucess falg to 1 4 the time beigng mail func not called
    header("Location:./thank-you-quote.php?sucess_flag_admin=".encrypt($sucess_flag_admin ));

我收到的电子邮件

估计托马斯, 信息共享 Nombre del producto Nombre de la subcategoría Nombre de la categoría HPDFO - Lente Alta Definición Accesorios VersaLaser®

格雷克!国际会计准则 Por visitar nuestro sitio y enviarnos s!你好啊。 Su información de contacto es segura y no será compartida con nadie。 Nospondremos en contacto con usted dentro de 24 horas。

www.International.com


这是一封西班牙邮件

这里有一些!进入那封邮件。

我现在不知道它为什么会出现。

请帮我解决这个问题。

提前致谢

【问题讨论】:

    标签: php email


    【解决方案1】:

    有时它可能会因为冗长的线条而发生。

    您可以使用 base64 编码:添加“Content-Transfer-Encoding: base64”标头并将内容编码为

    $base64contents = rtrim(chunk_split( base64_encode($contents)));

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多