【发布时间】:2021-08-31 12:13:49
【问题描述】:
我已将 PHPMailer 连接到我的注册系统,一旦用户注册,它会自动向注册用户发送电子邮件,现在我在发送电子邮件时尝试设置新行时遇到问题:
"Hello, ".$formvars['name']."<br>".
"Thank you for your registration with us and trusting us with your user account!"."<br>".
"If any problems arrise with logging into your account or using it, please adress this email."."<br>".
"\n".
"Kind Regards."."<br>".
"Auto-Bot!"."<br>";
我真的不明白为什么它不能正确换行,\n 或 \r\n 不会显示在电子邮件中,但也不会换行。
更新:
为没有提供足够的代码道歉,问题是我调用了 isHTML 并尝试这样做,我将行更改为使用
【问题讨论】:
-
可能是您正在发送 HTML 电子邮件,或者邮件客户端认为您在发送。试试
<br>而不是\n。 -
请与我们分享您的锻炼、代码 sn-ps、错误日志或任何有用的信息,以帮助回答您的问题。