= ar_mailer (with priority queue) Ar_mailer is a gem that implements an email queue for Ruby on Rails in a transparent way. After changing one setting, all of the usual 'deliver_xyz' mailer methods will, instead of actually sending out an email, create a new row in the 'emails' table which is used as the queue. A separate daemon checks that table periodically and does the actual delivery. This can greatly speed up the response time of Rails actions that are locked for a long time by the process of sending out large emails. This project was forked from: https://github.com/adzap/ar_mailer Which was forked from: http://rubyforge.org/projects/seattlerb It adds one additional feature to ar_mailer - the ability to prioritize emails, so that for example newsletter sending out doesn't block the sending out of more time-critical email messages. For general ar_mailer setup instructions see the original sources: https://github.com/adzap/ar_mailer http://rubyforge.org/projects/seattlerb == Installing ar_mailer There is a gem you have to install instead of the usual ar_mailer: $ sudo gem uninstall ar_mailer $ sudo gem install rzeszotko-ar_mailer Then in environment.rb you have to do: config.gem "rzeszotko-ar_mailer" You may also need to do an additonal require: require 'rzeszotko-ar_mailer' == Usage The difference from regular ar_mailer is in that you can specify a priority for a given email: class Emails < ActionMailer::Base def newsletter(newsletter, users) from "John Doe " recipients users.collect(&:email) sent_on Time.now subject newsletter.subject priority 100 body :newsletter => newsletter end end Emails with lower priority are send out first, and the default priority (when you do not specify one explicitly) is 0.