Introducing the dkim gem
DKIM (defined in RFC 4871) is a way for email senders to claim responsibility for an email message. It works by adding an extra header to every email sent which cryptographically signs the message’s headers and body. By verifying the signature, the receiver of DKIM-signed email can be certain the emails content has been unaltered and comes from who is claimed. By taking responsibility for these messages, the sender’s reputation can allow the message to be less scrutinized by spam/phishing filters on the receivers end. For this reason, DKIM is desirable because is should increase deliverability.
I had the need to send a large amount of email through Amazon SES from a rails application. This was made very easy by the terrific fog library for accessing cloud services (I would recommend version 0.8.2 or above, which includes a bug fix I submitted). However I found no good way to DKIM sign email from ruby. There was a rubydkim gem, but it didn’t work correctly in my testing, and required an external C library.
This prompted me to create the dkim gem: a simple ruby library for DKIM signing email messages. dkim depends only on ruby built with openssl support (or jruby-openssl if you’re using jruby).
Most basic usage (which should be all that is necessary for most) is to configure the gem globally
and then to sign any messages as needed
A more detailed explanation can be found in the project’s README on github.
I hope the library proves useful to others, and would love to hear from anyone using it.