Wednesday, March 12, 2008

Wanna send email to from PHP mail()? SUX...

Hello everyone,

I know you've noticed that I am not quite often blogging, but I am and will try to post interesting tech stuff here.

Today's topic: Sending email to Hotmail account from PHP.

Sounds easy. Some of will say "just use PHP's mail() function with correct headers". Yeah, but not. :)
I read almost all posts on this topic around the net with no success. So finally I started trying and trying ... after the 5th or 6th hour (God bless I started in the morning of the day else I would probably throw my MacBook out of the window) I managed to send emails to Hotmail successfully!

1) Do NOT put any "a href" tags in the email
2) Put ONLY email address in the TO: and FROM: headers of the email
If you do one of the above your email won't even be in the Junk!
3) Do NOT send email from address like: [email protected] or [email protected]
or it will go to Junk! folders in Hotmail accounts

That's it! Enjoy! :)

Ouh, I forgot to mention that I wanted to send HTML emails. ;-)


  1. Anonymous3:16 PM

    I cant fing the to in my code I just send you the code and if you could direct me it would be great thank you
    $success = mail($recipientEmail, $Subject, $message, $headers."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1");

  2. Email me svilen AT svilen DOT com ;-)

  3. Anonymous1:42 PM

    @Svilen Spasov you are a moron for not posting the code....

    1. And you are definitely stupid as hell for not knowing how to write a simple code executing mail(). :)