PHP mail() function cannot send to hotmail?

user569322 picture user569322 · Apr 27, 2011 · Viewed 11.1k times · Source

Okay, I have searched on the internet for answers- sadly to no avail. I'm trying to send mail using the PHP mail() function so members can follow the link to register. It works for Gmail, Yahoo!, but not for Hotmail. Please help meh!!!

   <?php
$headers .= 'To: <[email protected]>' . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$text="hello";
$text = str_replace("\n.", "\n..", $text);
mail('Kenny Worden:<[email protected]>','Leos Realm account verification!',$text,$headers);
?>

If this helps anyone:

SMTP : localhost(srv30.000webhost.com)

SMTP PORT: 25

Answer

Sabeen Malik picture Sabeen Malik · Apr 27, 2011

Your code seems to be good. My guess is that there is something wrong at your servers end, check mail delivery logs or have your server admin look at them for you. Could be a routing/dns issue.

edit: i just tried that script on my server and it works well. immediately got email on my hotmail address.