0
我正在爲組織編寫一個小型CakePHP應用程序,並且包含一個簡單的聯繫表單,它接受一個電子郵件地址,主題和消息以及電子郵件該消息發送到該地址。通過CakePHP發送的電子郵件通過POP訪問時出現空白郵件正文
一切似乎都做工精細,並在組織上派給自己或任何人的任何電子郵件到達就好了,除非他們通過POP,其中大部分都做訪問的消息。在這種情況下,電子郵件到達的主題,但身體是空白的。但是,如果郵件是通過網絡郵件客戶端讀取的,則正文顯示得很好。
有沒有其他人遇到這個問題?這是CakePHP的問題,電子郵件標題,還是應該與託管公司交談?我的代碼直接基於the example given in the CakePHP documentation。
這裏有接收請求數據和發送電子郵件中的控制器動作:
function send() {
if (!empty($this->data)) {
$contact = $this->Contact->read(null, $this->data['ContactMessage']['contact_id']);
$this->data['ContactMessage']['ip'] = $this->RequestHandler->getClientIp();
$this->ContactMessage->create();
if ($this->ContactMessage->save($this->data)) {
$this->Email->to = $contact['Contact']['email'];
$this->Email->subject = $this->data['ContactMessage']['subject'];
$this->Email->replyTo = $this->data['ContactMessage']['email'];
$this->Email->from = $this->data['ContactMessage']['email'];
$this->Email->sendAs = 'both';
$this->Email->send($this->data['ContactMessage']['message']);
$this->redirect(array('controller' => 'contacts', 'action' => 'thanks'));
} else {
$this->redirect(array('controller' => 'contacts', 'action' => 'oops'));
}
}
}
這似乎是問題所在。切換到「sendAs ='文本'」似乎修復了它。謝謝! – 2009-09-25 21:04:42