NameSilo

Php mail() does not send mail to hotmail.

Spaceship Spaceship
Watch

harj_p

New Member
Impact
0
Hey Guys,

I'm trying to send email using PHP mail() and it works fine except with hotmail. :td:

for some reason hotmail is not accepting emails from my server www.harjot.com

can anyone please let me know what i could be doing wrong?
here is the code:

$from_name = "my name";
$from_email = "[email protected]";
$subject = "October 22 2005";
$to_email = "[email protected]";
$message = "message test";

$from1 = "From: ".$from_name." <".$from_email.">";
$from2 = "-f".$from_email;

mail($to_email, $subject, $message, $from1, $from2);
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Do you get an error when sending to hotmail?
Did you check the junk mail folder in hotmail?

Rhett.
 
0
•••
The problem is with $from1.

It should be:
$from1 = "From: " . $from_name . " <" . $from_email . ">\r\n";

I'm not sure what $from2 does. :\
 
0
•••
It seems it's hotmail's problem, not php's problem. It's microsuck, they probably "protect" you by comparing the IP of the sender to the email domain, but really they **** up web applications. It happens with only the bad email providers. I suggest you change providers, or use an email address at your domain
 
0
•••
Dan Friedman said:
The problem is with $from1.

It should be:
$from1 = "From: " . $from_name . " <" . $from_email . ">\r\n";

I'm not sure what $from2 does. :\
I have been able to send email using mail() in php many times with the same small header that harj_p has used, and without the correct header information I've found that the email still sends to the address, just a few little bugs occur in the email.

Very strange that this is happening, my suggestion is to send it to a few different hotmail addresses, see if it sends to any of them, if not, your ip or domain may have been banned previously perhaps?

UPDATE: Ok, just tried your script and it works fine with my hotmail address :tu:. Although it does go into the junk-mail folder.

Best of luck,
Rhett.
 
0
•••
someone could be spamming on the server if its shared and hotmail banned the ip
 
0
•••
BillyConnite,

All I did was add "\r\n"

The bugs are the headers being wrong. ;) And that is why.
 
0
•••
Dan Friedman said:
BillyConnite,

All I did was add "\r\n"

The bugs are the headers being wrong. ;) And that is why.
Hey Dan,

I used harj_p's first version wihtout the "\r\n" and it works fine, im sure yours does too, and am sure that the addition to the headers is also correct :tu:-, but that isn't what is causing hotmail to not receieve it, as harj_p's first version works fine for me.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back