2015-09-30 120 views
-2
App::uses('CakeEmail', 'Network/Email'); 
    $Email = new CakeEmail(); 
    $Email->to($emailContentArray['To']); 
    $Email->from(array($emailContentArray['From'] => Configure::read('FROM_NAME'))); 
    $Email->subject($emailContentArray['Subject']); 
    $Email->emailFormat('both'); 
    $response=$Email->send($emailContentArray['Body']); 

如果我們檢查所生成的電子郵件,它看起來像: -無法發送電子郵件作爲CakePHP中的純文本和HTML

Content-Type: multipart/mixed; boundary="782f009f669cbcf2faafff59fe0eeb5d" 
Content-Transfer-Encoding: 8bit 
X-Identified-User: {:test25.xyzzzz.com:testttt.com} {sentby:program running on server} 

--782f009f669cbcf2faafff59fe0eeb5d 
Content-Type: multipart/alternative; boundary="alt-782f009f669cbcf2faafff59fe0eeb5d" 

--alt-782f009f669cbcf2faafff59fe0eeb5d 
Content-Type: text/plain; charset=UTF-8 
Content-Transfer-Encoding: 8bit 

<div>​<BR>Hi<BR><BR>Soon you will reach the action limit. To keep yourself updated please pay the payment.<BR><BR> Happy to&nbsp; have you<BR><BR>Thanks,<BR>Apps Team<BR>​</div> 


--alt-782f009f669cbcf2faafff59fe0eeb5d 
Content-Type: text/html; charset=UTF-8 
Content-Transfer-Encoding: 8bit 

<div>​<BR>Hi<BR><BR>Soon you will reach the action limit. To keep yourself updated please pay the payment.<BR><BR> Happy to&nbsp; have you<BR><BR>Thanks,<BR>Apps Team<BR>​</div> 

在text/plain的電子郵件不應該顯示html標籤 - 如何我可以同時獲得html和純文本的正確發送嗎?

+0

什麼是'$ emailContentArray ['Body']'?它似乎可能是一個html字符串。 – AD7six

回答

相關問題