我在我的网站中使用phpmailer发送电子邮件。我的代码运行良好,但有时电子邮件消息正文中会随机出现感叹号。我的代码如下:
$mail->SetFrom(FROM_EMAIL,FROM_NAME); //emailid of sender(admin)
$mail->Subject = 'Subject here.'; //subject of email
$mail->AddAddress(Address here); //emailid of user(recipient)
$content = 'some html code here';
$mail->MsgHTML($content); //this is body of email
$mail->Send();
这个可以正常运行,但有时候会出现感叹号,不知道为什么。提前感谢...
!
或问号?
?? 如果电子邮件客户端错误解读了字符集(因为您的消息错误地报告了它),则通常会出现无效字符作为?
。 - Michael Berkowski$mail->CharSet = 'UTF-8';
。 - Michael Berkowski