Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

ar_mailer: Batch Send ActionMailer Messages

By Hendy Irawan / June 9, 2007


ar_mailer is a Ruby gem by Eric Hodel (a ZenTest core developer) that works with Rails to store outgoing e-mail messages into the database for later delivery by a separate ar_sendmail process. This is handy because delivering e-mails can take a long time if performed before rendering pages, especially if you have hundreds of messages to send!

Version 1.2.0 adds TLS (Transport Layer Security) support and numerous other bug fixes and updates. To install:

gem install ar_mailer

Note: If you still get the old 1.1.0 version even after doing a gem install, you can download the .gem file directly from Seattlerb Rubyforge Project Page.

About Hendy Irawan

Ruby programmer from Indonesia. View all posts by Hendy Irawan →


  1. Eric Hodel says:

    I'm consolidating all my gems into the seattlerb project, so I had to get the RubyForge guys to fix up the authoritative project. Should be good to go now.

  2. andy says:

    Oracle does not like having a column named "from".

  3. andy says:

    Actually, it doesn't like the "to" column either. I just tweaked the migration and gem code to have a "_address" suffix.

  4. Peter Cooper says:

    If you can, report your findings to the developer and/or submit a patch if possible. Thanks for posting a report here though, I'm sure it will help a few confused souls! :)

  5. Dr Nic says:

    You can also use the Tracking system on the seattlerb project on rubyforge for bugs etc

  6. Hendy Irawan says:

    Another very useful feature ar_mailer/ar_sendmail is its ability to queue/throttle outgoing emails in batches. Most shared hosting companies limit your capacity to send mails to prevent customers misusing them for spamming.

    HostingRails, the web hosting company that I am using (and they're a very good at it!), limits to around 200 messages per hour, which is reasonable. They actually recommend customers to use ar_mailer for mailing purposes.

    ar_mailer makes sending e-mails not only much faster (from the perspective of the calling context) but also more reliable, as your apps won't just fail when something bad happens temporarily to the sendmail/SMTP server.

Other Posts to Enjoy

Twitter Mentions