Send unicode emoji with PHPMailer

老子叫甜甜 提交于 2019-11-30 21:38:23
drakyoko

It turns out that PHPMailer uses charset=iso-8859-1 by default in HTML emails (in the email header you'll find Content-Type: text/html; charset=iso-8859-1 while you should use UTF-8: Content-Type: text/html; charset=UTF-8.

You can set the charset in PHPMailer by doing:

$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';

I needed to use the slightly different:

$mail = new PHPMailer();
$mail->CharSet = 'utf-8';
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!