PHP电子邮件中的新换行符 [英] PHP new line break in emails

查看:343
本文介绍了PHP电子邮件中的新换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

$message = "Good news! The item# $item_number on which you placed a bid of \$ $bid_price is now available for purchase at your bid price.\n
The seller, $bid_user is making this offer.\n
\nItem Title : $title\n

\nAll the best,\n
$bid_user\n
$email\n
";

echo $message;
$htmlContent = $baseClass->email_friend($item_number, $title, $bid_price, $bid_user, $mcat, $message, $email, $VIEWSTATE, $EVENTVALIDATION, $URL);

问题在于新换行符 (\n)不起作用.

推荐答案

尝试用\r\n代替\n

\ n和\ r \ n 之间的区别

应注意,这适用于电子邮件中的行退回.对于其他情况,请参阅rokjarc的 answer .

It should be noted that this is applicable to line returns in emails. For other scenarios, please refer to rokjarc's answer.

这篇关于PHP电子邮件中的新换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆