tags:

views:

355

answers:

1

I know. I sound like a spammer but these emails are completely legitimate email confirmations for people that have signed up for an account on this website we developed. These emails all make it through to various mail providers (gmail, yahoo, aol, hotmail/live) but they always get directed into the Outlook Junk Email folder. I am have tried using Zend Framework mail, PEAR Mail and phpMailer. All of those methods result in the same thing happening.

This seemed to start happening after Microsoft released their update to the Outlook Junk Email filter in January of this year.

Following is the code in question:

include_once('Mail.php');
include_once('Mail/mime.php');
$hdrs = array(
 'From'    => "Membership <[email protected]>",
 'Subject' => 'Test Email',
 'Reply-To'=> "[email protected]",
 'Message-ID'=> "<" . str_pad(rand(0,12345678),8,'0',STR_PAD_LEFT) . "@mail.example.com>",
 'Date'=> date("D, j M Y H:i:s O",time()),
 'To'=> '[email protected]'
         );
$params = array('host'=>'mail.example.com','auth'=>false,'localhost' => 'www.example.com','debug'=>false);
$crlf = "\n";
$mime = new Mail_mime($crlf);

$mime->setTXTBody("TEST");
$mime->setHTMLBody("<html>\n<body>\nTest\n</body>\n</html>");

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('smtp',$params);

$t=$mail->send('[email protected]', $hdrs, $body);

As you can see we are using the PEAR Mail functionality in this test. This is the most basic test we could run and the above generated email gets dumped into the Outlook Junk Email folder. We have reverse DNS on the mail server and it matches the forward DNS, SPF and DKIM are set up and there is nothing "spammy" with the above content. Can anybody see something with the above code that could cause Outlook to mark it as Junk? Thanks!

+2  A: 

Your delivery rate has little to do with your software and a lot to do with the reputation your domain and IP has with the recipient's mail hosts. Having SPF and DKIM in place will certainly help matters (and will help build reputation over time), but if emails sent from your domain/IP did or do get classified as users by junk (or you do other things that seem fishy to the providers like sending too many emails to their domain per unit time), no amount of effort on your end can overcome that.

In my experience, those factors are far more likely to trigger a junk mail designation than something esoteric about your email headers or body. Now if you have certain popular keywords in your email that's another matter :-)

Most of the major providers offer white list programs with varying conditions. You can find out about them via Google.

Eric J.
Would Outlook on the same network as the sending web server really pay attention to SPF and our 'sender reputation'? I didn't think Outlook did any network tests to determine the validity of SPF records, etc. This email makes it through to the web email providers, Gmail, Hotmail, Yahoo, etc.
I'm not aware that Microsoft releases the exact criteria they use for the Outlook filter (if someone knows where to find that info please post :-) but I understand that information obtained from Hotmail is one factor. They may also make use of data from DNS blacklists and DNS whitelists. I have seen deliverability through the Outlook filter improve after an IP was "warmed up" by sending a slow, steady stream of legit email for a few weeks. Since I don't know Microsoft's exact algorithm, I don't know if that was chance or not.
Eric J.
I have been watching network traffic from my workstation while opening/downloading emails with Outlook and haven't seen any network tests so I was assuming, possibly wrongly) that Outlook was judging based on content both in the headers and the body. Who knows. Thanks for your insight.
@robertabead: You are probably right that there's no real-time network tests (otherwise the frequent updates would be unnecessary). I suspect they have a clever way to package information gathered from various online sources and make statically available on each PC. You can test that theory by installing Outlook into a fresh virtual machine and not applying updates, then testing if your email gets through. Firewall all internet access except to your mail server.
Eric J.