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!