tags:

views:

154

answers:

1

Hi,

I have some issues with my email -body when i send mails

I'm using php in my site.

My website is a spanish site , when ever i send a mail some special characters are comming in that mail.

Always there is an ! mark in that mail, that too in the same place

below is the code which i'm using and an email which i got.

Code

$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 ));

Email which i received

Estimado Thomas, Solicitud de cotización de Información Nombre del producto Nombre de la subcategoría Nombre de la categoría HPDFO - Lente Alta Definición Accesorios VersaLaser®

Grac! ias Por visitar nuestro sitio y enviarnos s! u solici tud. Su información de contacto es segura y no será compartida con nadie. Nos pondremos en contacto con usted dentro de 24 horas.

www.International.com


This is a spanish mail

here there are some ! coming inside that mail.

I dont now why its comming.

Please help me to fix this issue.

Thanks in advance

A: 

Some time It could happen because of looooong lines.

You can use base64 encoding: add a "Content-Transfer-Encoding: base64" header and encode the contents with

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

nik