PHPMailer - 尝试在发送电子邮件时设置新行

PHPMailer - Trying to set new line while sending emails

我已将 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 并尝试这样做,我更改了使用

拆分的行

猜测(因为你没有 post 你的代码),你可能发送纯文本 HTML,并且 HTML 会忽略换行符,所以省略您代码中的这一行:

$mail->isHTML();

如果您想使用 HTML,您可以使用 HTML 标签,例如 <p><br> 来拆分您的文本。