Outlook Marking Email as Junk Email
I know. I sound like a spammer but these emails are completely legitimate email confirmati开发者_JAVA技巧ons 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 <membership@example.com>",
'Subject' => 'Test Email',
'Reply-To'=> "membership@example.com",
'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'=> 'test@example.com'
);
$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('test@example.com', $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!
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.
精彩评论