Sjoerd Maessen blog

PHP and webdevelopment

Tips that prevent your mailing being marked as ‘spam’

with one comment

Introduction

The last couple of weeks I was working on writing a mailing/newsletter system myself. One of the first questions that came up was “how do I prevent that my newsletter will be marked as spam”. Although this article has nothing to do with PHP I still like to put it in the spotlight. I will give some tips on how to avoid your mail being marked as spam, some you will know, others you won’t.

How is determined if my email is spam?
Mostly this is done by so called spam filters (server side or client side), some well known examples:

Some of them work with the Bayesian filter. This filter is one of the most accurate filters available. It will detect 98% of the spam mails by an algorithm. Essentially the filter will check if words occur a lot in spam mails but not in normal mails, if spam words occur a lot in a mail we can assume we are dealing with a spam mail. Before we can use this filter we need to build a database with legitimate words. This database is build by the filter, it monitors all outgoing mails from the user and the incoming mails. By checking which words are used in the outgoing mails from the user it can “learn” which words are legitimate. Each word will get a score, the score will represent the probability of the mail being a spam mail (the mail in which the word appears).

An example:
We take the word “casino”, let’s suppose this word occurs in 100 of the 500 spam mails and only in 5 of the 500 legitimate mails. The spam score for this word will be:

(100/500) / (5/500 + 100/500) = 0,95

Off course spam filters use a lot of other techniques too.

Tips to lower your spamscore
I hope you now have a more clear understanding of how the most spam filters work. So lets start with some tips.

  • don’t use words and phrases that are often used in spam mails, for a small list see the Microsoft Junk E-Mail Filter Readme, also the use of complete phrases in capitals is killing.
  • use a dedicated mailserver, why? Most filters will recognize the IP from which a mail is coming, if the mailserver IP is recognized as a server from which the filter is getting legitimate mails more often, it will work in your advantage
  • Don’t send any attachments with a mailing, virus scanners aren’t too happy about them, neither are spam filters
  • Send good content. Try to make the content of each newsletter as different as possible, filters will recognize texts that have occurred before. Also pay attention not to send just one big image and just a few lines of text, you will get a penalty for that one too. Find a balance between the amount of images, the size of them, and the amount of text.
  • Use a real mail address from which the newsletter is coming, filters will often check the domain (using an address with a domain like hotmail, gmail, yahoo,… doesn’t count).
  • Don’t use url shorteners, url shorteners like bit.ly or TinyUrl are often used by spammers

A last one, but nevertheless an important one “don’t prevent your mail being marked as spam”. Okay that sounds silly right? What I mean is that if you write a whole paragraph in your mailing about how someone can unsubscribe this will be seen as suspicious also avoid text like “this is not spam”.

More tests that will possibly increase your spam score can be found on the website of SpamAssassin. Some tests that caught my eye:

  • use of the tbody html tag
  • message body has many words used only once (this one increases your spam score a lot)
  • Invalid date in header (wrong EST timezone)

Keep the above in mind when writing your next mailing 😉 good luck!

Written by Sjoerd Maessen

May 3rd, 2010 at 7:13 am

Posted in Mail

Tagged with , ,

One Response to 'Tips that prevent your mailing being marked as ‘spam’'

Subscribe to comments with RSS or TrackBack to 'Tips that prevent your mailing being marked as ‘spam’'.

  1. Another “indirect” tip might be to read up on SPF, the Sender Policy Framework, for not letting your e-mail be marked as spam when it’s sent to Hotmail or Live Mail addresses.

    iwan Luijks

    7 Jun 10 at 10:49 pm

Leave a Reply