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


Email -- what is the correct way to do new line in email message?

$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>';

问题是它显示在电子邮件中:下载手册

有什么办法吗?

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

此外,还应使用 'r'n 与邮件客户端兼容。

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

尝试使用"''r'"作为换行符。

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