电子邮件 - 在电子邮件中添加新行的正确方法是什么?

时间:2012-04-02 04:59:59

标签: php email

$message = 'New user registration\n\n
There is a new submission on the site and below are the details.\n\n';

我尝试使用html但它在电子邮件中显示文本,因此我将其更改为纯文本。还是不能断线。

我不确定为什么它不像我想的那样工作。

编辑#2

$umessage .=    '<a href="'.$pdflink.'">Download Brochure</a>';

问题是它显示在电子邮件中:Download Brochure

周围有什么办法吗?

2 个答案:

答案 0 :(得分:6)

使用单引号字符串时,不会解释换行符。您需要使用"来封装字符串。

此外,您应该使用\r\n与邮件客户端兼容。

$message = "New user registration\r\n
There is a new submission on the site and below are the details.\r\n";

答案 1 :(得分:3)

尝试使用“\ r \ n”作为换行符。

$message = 'New user registration\r\n
There is a new submission on the site and below are the details.\r\n';