Php 在邮件正文中显示新行
我想在邮件正文段落中插入新行。我已经搜索了所有其他相同的问题,但似乎没有一个有效Php 在邮件正文中显示新行,php,html,email,Php,Html,Email,我想在邮件正文段落中插入新行。我已经搜索了所有其他相同的问题,但似乎没有一个有效 $body = "Dear $surname $name \r\n Thank you for your Pre-registration for Global .\r\n Please print the attached e-ticket with your personal barcode and bring it to the reception of the exhibition.\r\n This b
$body = "Dear $surname $name \r\n
Thank you for your Pre-registration for Global .\r\n
Please print the attached e-ticket with your personal barcode and bring it to the reception of the exhibition.\r\n
This barcode includes data about you which is required during registration. Having this barcode will considerably speed up the registration process
Organizing committee.\r\n".
$body = "Print e-ticket
($imageurl) .\r\n".
此方法在一行中显示所有内容
如何更改它以正确显示它?
谢谢如果您使用身体的html格式,则必须使用
而不是\r\n
ps:您有两个
$body=..
,因此您的第二个将覆盖第一个您只需在函数中设置文本/html
内容类型标题即可使用
像这样,
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$body .= "Print e-ticket
($imageurl) \r\n".
您需要将邮件()的标题设置为第四个参数
mail($to,$subject,$message,$headers);
还可以使用
附加字符串
像这样,
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$body .= "Print e-ticket
($imageurl) \r\n".
您使用的是哪种内容类型?