function sendEmail($address,$subject,$message)
{
$headers = "Reply-To: miloAds Team <admin@miloads.com>\r";
$headers .= "Return-Path: miloAds Team <admin@miloads.com>\r";
$headers .= "From: miloAds Team <admin@miloads.com>\r";
$headers .= "Organization: Milonas Media LLC\r";
$headers .= "MIME-Version: 1.0\r";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r";
$headers .= "X-Priority: 3\r";
$headers .= "X-Mailer: PHP". phpversion() ."\r";
mail($address, $subject, $message, $headers);
}
发送电子邮件时,标题会显示在正文中。
答案 0 :(得分:1)
尝试将每个\r
转义更改为\r\n
,看看是否有帮助。
additional_headers (可选)
String to be inserted at the end of the email header. This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).
确保不在最后一个标题中包含尾随\r\n
。
还要确保从$subject
中删除任何可能导致问题的新行。看看那些帮助。
答案 1 :(得分:0)
将\n
添加到\r
,即\r\n
并删除最后一个:
function sendEmail($address,$subject,$message)
{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: miloAds Team <admin@miloads.com>\r\n";
$headers .= "Reply-To: miloAds Team <admin@miloads.com>\r\n";
$headers .= "Organization: Milonas Media LLC\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion();
mail($address, $subject, $message, $headers);
}