Jump to content

Recommended Posts

Hello

I am trying to generate a confirmation email in which the fonts are not in english.

I use the code bellow.  Problem is that some times the receiver receive the correct fonts & texts and some times giberish.  It must depend on the email software used or setting, etc.

Can anyone suggest a fool-proof way to ake sure the reciever will get te correct text?

Here is the code I am using:

 

 

$to = $Email1;

$subject = "123abc123.com - درخواست  ";

$from_email= "FROM: 123abc123.com";

$from_name= "hemaiat@123abc123.com";

$body = $UN." اسم کارائی:";

 

$headers  = "MIME-Version: 1.0 \n" ;

$headers .= "From: " .

      "".mb_encode_mimeheader (mb_convert_encoding($from_name,"UTF-8","AUTO")) ."" .

      "<".$from_email."> \n";

$headers .= "Reply-To: " .

      "".mb_encode_mimeheader (mb_convert_encoding($from_name,"UTF-8","AUTO")) ."" .

      "<".$from_email."> \n";

   

$headers .= "Content-Type: text/plain;charset= UTF-8\n";

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

$sendmail_params  = "-f$from_email";

mb_language("uni");

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

$subject = mb_encode_mimeheader($subject);

mail($to, $subject, $body, $headers, $sendmail_params);

Link to comment
https://forums.phpfreaks.com/topic/159338-sending-utf-8-email/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.