Sending emails for your app and avoiding the spam trap. Signing emails with Domain Keys/DKIM example
"So you’ve started sending email from your site/application, your application is doing well and you are now sending more e-mail daily. With this comes the fun of finding out that most of the email you now send ends up stuck in your customers spam filters – how did this happen? You aren’t a Nigerian scammer, and people opted-in to hear from you! At this point signing your mail may be the next step.
I recently wrote a post on What good developers should know about sending mail, where i talked through the basics that all developers need to know about sending email before they simply start talking to SendMail or fire up an instance of SmtpClient.
My post covered a few things you should make sure you do when sending email through code:
- Send email from a real email address (hey it may sound crazy but people might want to reply…?)
- Never send mail from a domain you do not control (that’s what reply-to is there for…)
- Make sure your mail server’s forward and reverse DNS records are configured properly and match their HELO/EHLO greeting.
- Setup an SPF record/Sender ID DNS record for server authentication.
If you are in the category of large sender, have stumbled onto the fact that a spammer used to use your IP address for nefarious means, or simply are having issues with the delivery rates of the mail you send out, one way you can add an extra tick of approval to the mail that you send is to sign your email using Domain Keys and DKIM.
Let’s take a look at how you would do this.
I thought this a great walk through and example and appreciated the number of libraries that were mentioned, as well as the alternate means of sending email.