Problem is simple. Whenever I try to send an email from my PHP server to a hotmail address it doesnt even reach the hotmail INBOX and neither its SPAM folder.
I am using a custom function for emailing, but I guess that some of the headers are probably incorrect, or maybe they should be in a certain order?
function send_mail($from,$to,$subject,$body){
global $sitename;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: $to' . "\r\n";
$headers .= 'From: $sitename <$from>' . "\r\n";
$headers .= 'Cc: $from' . "\r\n";
$headers .= 'Bcc: $from' . "\r\n";
$headers .= 'Reply-To: $from' . "\r\n";
$headers .= "Return-Path: $from\n";
$headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n";
$headers .= "Date: " . date('r', time()) . "\n";
if (mail($to,$subject,$body,$headers)) {return TRUE;} else {return FALSE;}
}
I checked the server to see if it's blacklisted. It's not.
What could be the problem? Or maybe someone has a tested PHP mail function that worked with hotmail?
Thanks