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. ;-)