【发布时间】:2013-01-31 15:26:46
【问题描述】:
我正在使用SwiftMailer 发送电子邮件,但UTF-8 主题存在一些编码问题。 Swiftmailer 默认使用QPHeaderEncoder 对电子邮件标题进行编码,而safeMap 看起来对一些UTF-8 法语字符有一些问题。我使用的一个主题包含单词 trouvé(在法语中找到),当主题到达用户时,它会显示 trouv。
我想使用类似于 NativeQPContentEncoder 的东西,可用作内容编码器,但对于标头,只有 Base64 和 Quoted Printable 编码器。
有没有办法解决这个问题,也许我做错了什么所以我在这里粘贴我正在使用的代码
$message = Swift_Message::newInstance()
// set encoding in 8 bit
->setEncoder(Swift_Encoding::get8BitEncoding())
// Give the message a subject
->setSubject($subject)
// Set the From address with an associative array
->setFrom(array($from => $niceFrom))
// Set the To addresses with an associative array
->setTo(array($to)) ;
【问题讨论】:
-
我在消息中有类似的问题。
标签: php symfony swiftmailer