0
的電子郵件,我保存一個文本區域,該區域將用作電子郵件消息到數據庫中。 我可以正確保存它,但是當我試圖從數據庫中提取數據並使用該數據發送電子郵件時,我收到的電子郵件是一長串文本,而不是保持格式如何在文本區域。是否可以保持格式發送電子郵件?將textarea保存到數據庫中,並通過cakephp發送保留文本區域格式
例如:如果在文本區域我輸入類似:
This is line 1.
This is line 2.
This is line 3.
我得到的電子郵件將
This is line 1. This is line 2. This is Line 3.
我要的是什麼,我打字:
This is line 1.
This is line 2.
This is line 3.
這是代碼: App :: uses('CakeEmail','Network/Email');
$recipients = str_replace(' ', '', $recipients);
$recipients = explode(',', $recipients);
$email = new CakeEmail();
$email->from($user_email);
$email->to($recipients);
$email->subject($final_subject);
$email->template('download_link_email');
$email->emailFormat('both');
$email->viewVars(array('url' => $this->generateUrl('datas', 'download', $group_id, $user_id, $email_id), 'final_subject' => $final_subject, 'final_recipient' => $final_recipients, 'final_message' => $final_message));
$email->send();
和download_link_email模板
<html>
<head>
<title><?php echo $final_subject; ?></title>
</head>
<body>
<h1><?php echo $final_subject; ?></h1>
<p><?php echo $final_message; ?></p>
<p><?php echo $this->Html->link('Click here to download', $url);?>.</p>
</body>
</html>
至於文本區域是如何被保存到數據庫中,它是標準的CakePHP的風格
不知道這個問題,但似乎是大致相同 – Josejulio 2013-03-14 21:49:39