And*_*eda 3 php email format formatting
我想格式化邮件的内容以显示不同行的内容.这是我的消息背景.在这种情况下,\n和\ r不起作用.它只显示一行中的所有内容.
$message = 'Thank you for using . We really appreciate your business.'."\r\n".'If you are making your payment by mail, please make the check out to "blah blah" and send it to:'."\n".'blah blah '."\n".'blah blah'."\n".'San Gabriel, CA 91776'."\n".'Please see the attached invoice in PDF format for easy saving & printing purposes.';
$attachment = chunk_split(base64_encode($pdfdoc));
$headers = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$headers .= $message.$eol.$eol;
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: application/pdf; name=\"".$filename."\"".$eol;
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol.$eol;
$headers .= $attachment.$eol.$eol;
$headers .= "--".$separator."--";
mail($_POST['add6'],$subject, $message, $headers);
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
Pau*_*xon 13
您告诉电子邮件客户端消息是HTML,因此CR LF组合将被视为任何其他空白.
要解决此问题,请更改内容类型以显示您正在发送纯文本电子邮件
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"".$eol;
Run Code Online (Sandbox Code Playgroud)
或者,将您的消息转换为HTML消息 - 在您的情况下,一种简单的方法是通过nl2br运行它以将换行符转换为<br>标记
| 归档时间: |
|
| 查看次数: |
17585 次 |
| 最近记录: |