我有以下代码:
$subject = "Test Email"; $from = "noreply@bob.com"; ini_set("sendmail_from",$from); $message = "<html><body bgcolor=\"#DCEEFC\"> Hello<br><br> This is a <b>test</b> email. <br><br><hr> <a href=\"\">Click Here</a> <br><br><hr> <br><br> Thank you for your time,<br><br> </body></html>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "From: " . $from . "\r\n"; mail($mail,$subject,$message,$headers);
但是,当我向自己发送电子邮件时,我会在Outlook中看到所有代码.如果我将其发送给其他人,他们会看到HTML.如果我将它发送到我的hotmail,他们会看到HTML.
这是我的展望(2007)的问题,如果是,它是什么,或者我可以在电子邮件中做些什么来保证它正确显示?
请帮忙!
我发现了问题:
HTML Email not displaying correctly for Godaddy web based mail
更改:
$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "From: " . $from . "\r\n";
至:
$headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL; $headers .= "From: Site<$from>" . PHP_EOL;
谢谢你们的帮助! 原文链接:https://www.f2er.com/php/240157.html