我正在使用以下内容发送电子邮件:
<php ....
$message = 'Hi '.$fname.', \r\n Your entries for the week of '
.$weekof.' have been reviewed. \r\n Please login and View Weekly reports to see the report and comments. \r\n Thanks, \r\n'.$myname;
mail($to, $subject, $message, $from);
?>
Run Code Online (Sandbox Code Playgroud)
收到消息时,它不会在"\ r \n"处开始新行,而只是将它们作为消息的一部分打印出来.
我只在Thunderbird 3中尝试过,而不是任何其他客户端.
小智 109
尝试更改你'的"- php将单引号内的字符串解释为文字,而使用引号(")它会扩展\r\n到你想要的.
更多信息:http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
不是问题的答案,但可能对某人有所帮助。
发送HTML消息,而不要使用\ n <BR>。
并对<PRE></PRE>预格式化的文本使用或CSS,从而将\ n转换为实际的新行。
$headerFields = array(
"From: who@are.you",
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"
);
mail($to, $subj, $msg, implode("\r\n", $headerFields));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56260 次 |
| 最近记录: |