【发布时间】:2019-07-28 14:56:32
【问题描述】:
我在 PHP 中设置了一个 mail() 函数,当我通过电子邮件发送到我的电子邮件进行测试时,我注意到主题正在将我的 ' 转换为 '。
$subject="Please provide an updated copy of your company's certification";
结果:请提供贵公司认证的更新副本。
我跟着 Getting ’ instead of an apostrophe(') in PHP 添加了 mb_convert_encoding 但现在我得到的是 &rsquo 而不是 '。
$subjectBad="Please provide an updated copy of your company's certification";
$subject= mb_convert_encoding($subjectBad, "HTML-ENTITIES", 'UTF-8');
结果:请提供贵公司认证的更新副本。
我的个人电子邮件很好,所以有没有办法在 Outlooks 主题中正确显示 ' 或者我是否随心所欲地考虑他们的系统设置?
【问题讨论】:
-
你试过marking the content as UTF-8吗?另外,如果可以的话,我建议使用SwiftMailer,这样可以更顺畅地发送电子邮件并透明地处理所有事情。