开发者

How to get the received email with spaces in CAKEPHP?

开发者 https://www.devze.com 2023-01-08 12:13 出处:网络
In my cakephp website i have a controller which handles a simple contact form. But i have a problem! If in the contact_controller.php code i use:

In my cakephp website i have a controller which handles a simple contact form. But i have a problem! If in the contact_controller.php code i use:

$this->Email->send($this->data['Contact']['message']);
开发者_开发问答

i receive the email in my mail box with linebreaks like the user wrote the message. But if i use:

$this->Email->send();

and create an html template to get the variables that i want to receive in mail, i will receive the same with no linebreaks.

How i can fix that?


Which one do you want? In the first case you send a plain text email, so you will have your line breaks in place. In the second place you send HTML e-mail, where line breaks are in place, but simply ignored.

So either keep sending mails plain text or use nl2br() function on the body for html output.

0

精彩评论

暂无评论...
验证码 换一张
取 消