CakePHP电子邮件传输编码(CakePHP Email Transport Encoding)
我为CakeEmail创建了一个自定义传输(允许我使用Mandrill发送电子邮件)。 但是,每当我访问消息的内容(驱动蛋糕电子邮件模板)时,它都不会正确编码字符(它会将'é'更改为'é'等)。 如果我使用CakeEmail并绕过传输,它会在电子邮件中正确显示字符。 我已经将它缩小到传输代码中的$ email-> message('html')。 如果我输出$ email-> message('html'),则字符已经不正确。
App::uses('AbstractTransport', 'Network/Email'); App::uses('HttpSocket', 'Network/Http'); class MandrillTransport extends AbstractTransport { public function send(CakeEmail $email) { debug($email->message('html'));exit; } }
思考?
I've created a custom transport for CakeEmail (to allow me to use Mandrill to send email). However, whenever I access the content of the message (which is cake email template driven), it doesn't encode the characters correctly (it changes 'é' to 'é', etc). If I use CakeEmail and bypass the transport, it displays the characters correctly in the email. I've narrowed this down to $email->message('html') in the transport code. If I output $email->message('html'), the characters are already incorrect.
App::uses('AbstractTransport', 'Network/Email'); App::uses('HttpSocket', 'Network/Http'); class MandrillTransport extends AbstractTransport { public function send(CakeEmail $email) { debug($email->message('html'));exit; } }
Thoughts?
原文:https://stackoverflow.com/questions/28685107