Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chinese Characters PHPMailer

I'm using PHPMailer to send email from PHP. My email body contains HTML format and Chinese characters.

Chinese Characters are not shown correctly, it's changed to strange characters. I take the characters from database. It's shown perfectly if I view through web browser.

What variable of PHPMailer I have to initialize to solve this?

Any helps would be appreciated. Thank you.

like image 365
Jeaf Gilbert Avatar asked Oct 16 '25 19:10

Jeaf Gilbert


1 Answers

You probably use wrong encoding for HTML body. Some important properties are:

$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->MsgHTML($your_html_body);
$mail->CharSet="UTF-8"; // <-- Put right encoding here
like image 111
Eugene Avatar answered Oct 19 '25 10:10

Eugene