Optimizing mail() for company firewalls
i there.
I'm creating a newsletter for my company - the receivers will most likely be other companys employees using their company email adress.
The problem is, when I send mails using mail()
, it most will often be catched by the firewall marking it as spam, at it was sent by a webserver.
How can I optimize my function, so the amount of rejected mails will somehow reduce. I'm sure I can't开发者_如何学C reach the 100% but at least most of the receivers should get their mail.
Currently, this is how the function looks:
mail($email, $subject, $message, '-f info@mycompany.com\r\nfrom: noreply@mycompany.com\r\nreply-to: info@mycompany.com');
The best read on that topic i have ever seen is that one:
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
Hope it helps you too
You might have better luck trying to figure out what's causing your email to be trapped as spam rather than sitting around randomly changing headers/content. If you have (or can get) access to the spam filter's logs, see exactly what's causing your message to get canned.
Could be anything from the host you're sending from, subject line, black listed words, malformed headers, and a few other bajillion reasons as well.
mail($email, $subject, $message, '-f info@mycompany.com\r\nfrom: noreply@mycompany.com\r\nreply-to: info@mycompany.com');
Surely that should read:
mail($email, $subject, $message,
'From: noreply@mycompany.com\r\nReply-To: info@mycompany.com',
'-f info@mycompany.com');
If not, it's little wonder your spam filters don't like it.
Reverse engineering/bypassing spam filters is not supposed to be easy - but you might start by having a long hard look at how spamassassin decides what's spam and what isn't. Certainly its unusual to have a spam filter which does not implement Bayesian filtering - go check the manual on how to train it properly.
精彩评论