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

joe*_*joe 2 php email

$message = 'New user registration\n\n
There is a new submission on the site and below are the details.\n\n';
Run Code Online (Sandbox Code Playgroud)

我试图使用html,但它在电子邮件中显示文本,所以我将其更改为纯文本.还是不能断线.

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

编辑#2

$umessage .=    '<a href="'.$pdflink.'">Download Brochure</a>';
Run Code Online (Sandbox Code Playgroud)

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

它有什么办法吗?

Bur*_*lid 6

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

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

$message = "New user registration\r\n
There is a new submission on the site and below are the details.\r\n";
Run Code Online (Sandbox Code Playgroud)