这是我的代码:
$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');
同样的问题。它甚至没有发送到我的垃圾文件夹。