php mailer char-coding problem

Posted by Holian on Stack Overflow See other posts from Stack Overflow or by Holian
Published on 2010-03-22T10:40:39Z Indexed on 2010/03/22 10:41 UTC
Read the original article Hit count: 425

Filed under:

Hello!

I try to use Phpmailer to send registration, activation..etc mail to users...

 require("class.phpmailer.php");  
$mail -> charSet = "UTF-8";
$mail = new PHPMailer();  
$mail->IsSMTP();  
$mail->Host     = "smtp.mydomain.org";  
$mail->From     = "[email protected]";
$mail->SMTPAuth = true; 
$mail->Username ="username"; 
$mail->Password="passw"; 
//$mail->FromName = $header;
$mail->FromName = mb_convert_encoding($header, "UTF-8", "auto");
$mail->AddAddress($emladd);
$mail->AddAddress("[email protected]");
$mail->AddBCC('[email protected]', 'firstadd');
$mail->Subject  = $sub;
$mail->Body = $message;
$mail->WordWrap = 50;  
 if(!$mail->Send()) {  
   echo 'Message was not sent.';  
   echo 'Mailer error: ' . $mail->ErrorInfo;  
 }

The $message is contain latin characters. Unfortunatelly all webmail (gmail, webmail.mydomain.org, emailaddress.domain.xx) use different coding.

How can i force to use UTF-8 coding to show my mail exactly same on all mailbox? I try to convert the mail header width mb_convert_encoding(), but with no luck.

Thank you.

© Stack Overflow or respective owner

Related posts about phpmailer