Phpmailer & nbsp; is very powerful. it allows new PHP users to send emails in complex socket mode with simple configuration. However, phpmailer is written by foreigners, chinese garbled characters are not accidental. The following is my summary over the past few days to solve the problem of Chinese garbled characters in phpmailer sending. 1: Open phpmailer & nbsp; core file & nbsp; class.
Phpmailer? Very powerful. it allows new PHP users to send emails in complicated socket mode under simple configuration,
However, phpmailer is written by foreigners and Chinese garbled characters are not accidental.
The following is my summary over the past few days to solve the problem of Chinese garbled characters in phpmailer sending.
1: Open phpmailer? Core files? Class. phpmailer. php ?,? Yes? Public? $ CharSet? =? 'ISO-8859-1 ';??? Change? Public? $ CharSet? =? 'Utf-8 ';
$ Mail? =? New? PHPMailer ();
2: Set the email encoding;
$ Mail-> Charset = 'utf-8 ';
I believe many of my friends have been set to "GBK" or "GB2312". I started with it and later learned that Mail is internationalized, if you want to display Chinese properly in an international mailbox like Gmail, set the encoding to "UTF-8 ";
3: Set the title encoding;
Someone may ask here that the email encoding is set and what is the title encoding ...? If you have tested multiple kinds of mailboxes, you will find that the title is garbled in Chinese. that's right, even if you set it? $ Mail-> Charset = "UTF-8 ";
In this way, the Chinese garbled characters of the title will be solved.