Jag håller på med ett projekt, men får inte våran mailfunktion att fungera till hotmailaddresser, vare sig de skickas direkt eller forwardas från en annan adress. De fungerar utmärkt till de flesta mailadresser förutom just hotmailadresser. Någon som har en idé om varför? Så här ser mailfunktionen ut:
public static function sendInviteEmail($email, $projectID, $activationCode, $rank) {
$name = "ourProject";
$ourEmail = "None@ourProject.com";
$yourName = "Ost";
$to = " " . $yourName . "< " . $email . ">";
$subject = "" . $name . ": You are invited to join a project";
$message = "
<html>
<head>
<title> Invitation to join a project </title>
<body> You are invited to join our project with activation code ". $activationcode.". Bla bla bla.
</body>
</html>
";
$headers = "From: Our project <" . $ourEmail . ">\n";
$headers .= "Subject: $subject\r \n";
$headers .= "MIME-Version: 1.0\r \n";
$headers .= "Content-Type: text/HTML; charset=\"iso-8859-1\"\r \n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "Reply-To: Project Planner <" . $ourEmail . ">\n";
$headers .= "X-Priority: 3\r \n";
$headers .= "X-MSMail-Priority: Normal\r \n";
mail($email, $subject, $message, $headers);
}
I have found that putting "\r\n\r\n" after the last header (creates a blank line), and ensuring no spaces in the from header solved the problems I was having with hotmail accepting email from my mail() script.