以下邮件不会产生带双引号的换行符

时间:2018-12-17 09:55:46

标签: php html css email

我正在使用mail函数的另一个版本,并试图使\n\n正常工作,但是它没有按预期产生单独的一行。

这是我的代码:

// email body content
$htmlContent = "<h1>Thank-you for purchasing your Level 1 Monthly Subscriptionplan!</h1>
    <p>Dear $name \n\nThank you for purchasing your Level 1 Monthly Subscriptionplan for $price. \n\nPlease make sure that you check your student's general information to view your details carefully and note the expiry date for your subscriptionplan.\n\nFrom,\n\nPianoCourse101</p>";

2 个答案:

答案 0 :(得分:2)

\n将在代码中创建换行符,但不会在HTML段落中创建换行符。您可以将所有段落放在自己的<p></p>标记内,也可以在拥有<br />代码的地方使用\n\n\强制HTML换行

答案 1 :(得分:1)

在html邮件中,您应使用<br />添加换行符。

所有html解析器都将忽略代码中的\n行换行符。

相关问题