我正在尝试发送带有 UTF8 字符的电子邮件。大多数电子邮件看起来像我怀疑的那样,但随机会有垃圾字符。我相信在其中一个字符中间插入新行时会出现乱码。我怀疑 CakePHP 的电子邮件组件是罪魁祸首,因为我读到它具有根据其 lineLength 属性插入新行的功能。有没有什么办法解决这一问题?我正在使用 CakePHP 1.3。
$this->Email->to = $sendEmail;
$this->Email->from = empty($this->data['Contact']['email']) ? $sendEmail : $this->data['Contact']['email'];
$this->Email->subject = $subject;
$this->Email->sendAs = 'text';
$this->Email->template = 'contact'
$this->set('fields', $this->data['Contact']);
$this->Email->charset = "utf-8";
$this->Email->headerCharset = "utf-8";
return $this->Email->send();
从电子邮件标题:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit