1

I have a problem with hotmail, I am using PHP mail to send email, but all emails are going into the junk folder. Here is my code:

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Testing <abc@hotmail.com>\n";
$headers .= "X-Mailer: PHP's mail() Function\n";
mail("abc@hotmail.com", "Message", "A simple message.", $headers); 
Ivaylo Slavov
  • 8,839
  • 12
  • 65
  • 108
mon
  • 115
  • 2
  • 12
  • Have you tried sending it to another emailadress? Like a gmail or something. Could be it's just a hotmail/email-adres problem. – Wesley De Keirsmaeker Feb 25 '14 at 10:14
  • yes,In another email address (some emails are going in inbox and some are going in junk). – mon Feb 25 '14 at 10:18
  • Yeah there is not much you can do about this. If your email is redirected to spam then is probably there not because of the header but about other reasons (SMTP, hosting, IP etc.). I have same problems so i am start using www.mandrillapp.com. Sending up to 12000 email/month is free. Use their service (API) and your mails will be delivered. – StudioArena Feb 25 '14 at 10:37
  • thanks for this help,but i think this is a another issue,because we are not sending upto 200 emails/month. – mon Feb 25 '14 at 10:43

2 Answers2

1

This is probably because you are sending the mail from a different server than hotmail.com. There are many pitfalls when sending mails from code, see this article: http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

A better solution would be to use the official Hotmail SMTP server and your Hotmail SMTP account credentials and send the mail via SMTP. Try the Swiftmail library for easier handling of SMTP.

chiborg
  • 26,978
  • 14
  • 97
  • 115
  • we have a website, after the registration the alert message are send to users mail id,and mainly the hotmail users complaining about the junk folder issue. – mon Feb 25 '14 at 10:23
0

Unfortunately there is very little you can do about this. It's something in the spam filters that hotmail uses.

To help minimize it, try using SMTP rather than php.mail It's an actual mail-server, and there is POP3 authentication, so it's less likely to get flagged as spam. Details about the SMTP php class can be found here: http://www.phpclasses.org/package/14-PHP-Sends-e-mail-messages-via-SMTP-protocol.html

Other than that, there's very little you can do outside of good email templating: i.e. minimal images, no forms. Here's a pretty in-depth article about it: http://www.smashingmagazine.com/2007/10/16/best-practices-for-bulletproof-e-mail-delivery/

///edit: The answer to this solution may help you a bit. sending mail with php & escaping hotmails junk folder

Community
  • 1
  • 1
j bee
  • 86
  • 5
  • There's the php package: Just follow the install and use instructions: http://www.phpclasses.org/package/14-PHP-Sends-e-mail-messages-via-SMTP-protocol.html – j bee Feb 25 '14 at 10:29
  • we have a website, after the registration the alert message are send to users mail id,and mainly the hotmail users complaining about the junk folder issue – mon Feb 25 '14 at 10:34