Redline Software Inc. - Winnipeg's Leader in Ruby on Rails Development

Reverse DNS and Email

So you’ve setup your SPF records and your web app isn’t sending emails that contain any of the following words “FREE, enlarge, penis” etc, but email still isn’t reaching its destination?

RTFL! (where L is logs in this case)

/var/log/mail.log (or wherever your logs might be) might show something like:

Feb  4 06:42:49 yourhost postfix/smtp[5381]: 738F212E41A9: host[] said: 421-:  (DNS:NR) 421 SERVIC
E NOT AVAILABLE (in reply to end of DATA command)
Feb  4 06:42:49 yourhost postfix/smtp[5381]: connect to[]: server dropped connection without sending the initial SMTP greeting (port 25)
Feb  4 06:42:51 yourhost postfix/smtp[5381]: 738F212E41A9: to=<>,[], delay=1780, status=deferred (host
[] said: 421-:  (DNS:NR) 421 SERVICE NOT AVAILABLE (in reply to end of DATA command))

So you load up and find out that your server is missing a reverse DNS entry. Great now what?

Well if you don’t know what a reverse DNS entry is, it’s really not a hard concept. On a normal DNS lookup you’re usually asking for an IP address for a given domain name. A reverse entry is asking what domain is assigned to a particular IP address. This is useful in the battle against spammers.

First lets use dig to see if you really don’t have a reverse entry. Let’s pretend your email server is and your IP address for that mail server is

dig -x +short

The -x in the dig command will reverse that domain for you and the +short will cut straight to the answer for you. You should hopefully see something like:

dig -x +short

Give it a try with your IP, and if you get nothing back then you have no reverse pointer. To get one, you’ll likely have to request that your ISP add the record for you. If you’re on a VPS or something similar, put in a request to their support team to do this. Many of these companies have a form you can fill out online to do so.

Once they add it, give the above command a try again and you should be 1 step closer to being able to send legitimate email. Unfortunately there’s always more steps, but remember the logs are your friends…hopefully not your only friends though.