这是我的代码:
$boundary = sha1('whatever');
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'From: "Domainname" emailname@domain.com'."\r\n";
$headers .= 'Reply-to: Domainname <emailname@domain.com>'."\r\n";
$headers .= 'X-Priority: 3'."\r\n";
$headers .= 'X-Mailer: Mail 1.0'."\r\n";
$headers .= 'Subject: '.$subject."\r\n";
$headers .= 'Content-Type: multipart/alternative; boundary="'.$boundary.'"'."\r\n\r\n";
$message = '--'.$boundary."\r\n";
$message .= 'Content-Type: text/plain; charset="utf-8"'."\r\n\r\n";
$message .= $text."\r\n";
$message .= '--'.$boundary."\r\n";
$message .= 'Content-Type: text/html; charset="utf-8"'."\r\n\r\n";
$message .= $html."\r\n";
$message .= '--'.$boundary.'--';
mail($email, $subject, $message, $headers);
它适用于Gmail、Yahoo、GMX...但不适用于Hotmail/Live/MSN。
因为它适用于Gmail,所以我可以假设它与我的服务器无关,对吗?
我也尝试了只使用以下内容:
mail('username@hotmail.com', 'This is a subject', 'This is the body');
我也遇到了同样的问题,邮件甚至没有被发送到我的垃圾邮件文件夹中。