views:

24

answers:

3

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 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 [email protected]\r\nfrom: [email protected]\r\nreply-to: [email protected]');
+2  A: 

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

edorian
+1  A: 

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.

Marc B
+1  A: 

mail($email, $subject, $message, '-f [email protected]\r\nfrom: [email protected]\r\nreply-to: [email protected]');

Surely that should read:

mail($email, $subject, $message, 
 'From: [email protected]\r\nReply-To: [email protected]',
 '-f [email protected]');

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 RTFM on how to train it properly.

symcbean