Getting Your Web App's Mail Delivered 0

Web applications often need to send email to users for various reasons: forgotten passwords, reminders, announcements, and so forth. It’s easy enough to send mail with Rails—to get started, see How to Send Emails with Action Mailer.

I recently found, however, that mail from my applications was getting delivered to most, but not all, users. My two big problems were AOL users and companies that use a mail-filtering service called RedCondor.

Here’s the things I found to check. The lack of a reverse DNS entry turned out to be the source of my problems, but all of these items are important to check.

Reverse DNS

It’s important to make sure that your domain has a reverse DNS entry. This allows anyone to look up your domain name given your IP address. Some ISP, notably AOL, will not accept mail that comes from an IP address that lacks a reverse DNS entry.

To check the reverse DNS settings for your server, use a reverse DNS lookup tool, such as

If the IP address of your mail server doesn’t have a reverse DNS entry, you’ll need to ask your hosting provider to register it. (Unlike the regular forward DNS settings, you can’t change the reverse DNS because the hosting company, not you, owns the IP address.)

The AOL Postmaster web site provides additional information about AOL’s mail delivery requirements, as well as a tool for checking the reverse DNS as seen by AOL.

SPF Records

You should also ensure that your regular (forward) DNS settings include a SPF (Sender Policy Framework) record. The SPF record is a text string that you add to your DNS settings to specify from what servers mail from your domain may be sent. This allows mail recipients to confirm that mail claiming to be from you really came from your mail server.

Open SPF’s SPF Setup Wizard will create your SPF string based on information you enter. You then need to add that string to the DNS for your domain as a TXT record.

Put a Valid Email in the Return Address Header

Make sure your email is sent with a valid reply address. You want to be sure that you’re getting bounce messages, and some mail systems check for a valid reply address before delivering the mail.

Avoid Text That Triggers Spam Filters

Assuming your mail passes all the formatting and DNS tests, it can still be blocked as spam by filters at the ISP or in the recipient’s mail client. So you need to be careful that your messages don’t look like spam. Avoid terms like “Free”, excessive use of exclamation points, and names of drugs for erectile dysfunction. (I don’t know what you do if you have a legitimate email you want to send about Viagra.)

Reconsider HTML Email

If you’re sending text-only mail or can live without the graphics, send plain text mail. Plain text mail is less likely to be interpreted as spam.

If you do everything else right, though, HTML mail does seem to get delivered. Be sure your HTML is valid, since some mail systems will reject invalid HTML as likely spam.

Check Your Mail Server Log

Just in case something is going wrong that you didn’t anticipate, check your mail server log periodically to make sure there aren’t any errors occurring. If you use a utility such as Logwatch that emails you the interesting bits of all the system logs once a day, it’s easy to stay on top of any problems.

Whitelists

Email deliverability is a surprisingly rich and complex topic. If you want the best possible deliverability, you need to deal with whitelists maintained by various ISP and mail providers, such as Gmail, AOL, and MSN Hotmail. There’s also companies that monitor email deliverability. For a small site, however, this effort is prohibitive and shouldn’t be necessary.

If you’re sending high-volume email newsletters, you’re almost surely better off using an established service, such as AWeber, Vertical Response, or Campaign Monitor, where there are people whose full-time job is ensuring that the mail gets delivered.

Other Resources

What’s Been Your Experience?

If you’ve found other issues that are important to address to make sure mail generated by your web site gets delivered, please post a comment.

Comment



If you're reading this message, your browser is not interpreting the CSS file properly, and your comment may not be posted.