Sending Emails Without Becoming a Spammer

Page 1 - Server and Domain Configuration

Skip to navigation

Nov
11

If you are sending legitimate emails from your site then you should try to avoid them being marked as spam. Poorly constructed emails, or even incorrectly set-up domains can play a large part towards your IP address becoming blacklisted. In some cases those that use DNS Black Lists can also block your domain regardless of whether you change the IP address and/or hostname for the mail server. Of course though, not matter how hard you try there is still a possibility of your emails being marked as spam, especially if you genuinely are sending unsolicited emails.

This article covers:

  1. Server and Domain Configuration
  2. Email Accounts
  3. Email Headers
  4. Email Content
  5. Sender Policy Framework (SPF)
  6. Domain Keys Identified Email (DKIM)

Before you even think about sending emails from your site the first thing to do is to ensure that your webserver and domain are properly configured. Some spam checking tools will identify your emails as spam if your domain is not configured correctly. If you want to review your domain’s current settings then I would recommend a site such as http://www.mxtoolbox.com to check your DNS and MX records and to paste sample headers in for analysis.

As an example, I use Google as my email provider for the www.newearthonline.co.uk domain. This tool determines which hosts there are MX records pointing at and will allow you to check if any of them have been blacklisted. You can then analyse each individual host for things such as the time taken for the request. Slow response times from mail servers can also have an impact on your rating.

Large volumes of email are also seen as a likely source of spam so it is recommended to limit the number sent in one go by either configuring this in your mail server application such as sendmail, or to handle this in code. If you need to handle this with code instead of at the mail application level then you could for example use a database table for queuing up emails to be sent in batches. Where possible, providing a throttle at the server level would be better.

For example, if you are using sendmail then you may find your config file located in /etc/mail/sendmail.mc - you can then add or change the following to limit the number of simultaneous connections used:

define(`confCONNECTION_RATE_THROTTLE', `3 ')dnl

This isn’t fool proof though as it is limiting the outgoing connections, not the number of emails being sent. If you can’t build this into your application or website either, then another option is milter-limit.