public
Description: An email queue that actually works
Homepage: http://blog.matt-darby.com
Clone URL: git://github.com/mdarby/mq.git
mq /
name age message
file MIT-LICENSE Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
file README.textile Fri Oct 16 13:11:58 -0700 2009 Updated README (installation instructions) [mdarby]
file Rakefile Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
directory generators/ Sun Oct 18 07:40:25 -0700 2009 Added long forgotten spec [mdarby]
file init.rb Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
file install.rb Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
directory lib/ Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
file mq.gemspec Sun Oct 18 07:41:12 -0700 2009 Bumped version [mdarby]
directory tasks/ Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
directory test/ Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
file uninstall.rb Wed Feb 11 17:03:05 -0800 2009 Initial commit [mdarby]
README.textile

mq

A Rails gem that generates an MVC stack that does email queuing

What it does

mq is a generator that generates an MVC stack for queuing emails. It has a UI too.
I got tired of dealing with crappy email queuing systems in Rails, so I wrote my own.

Requirements

None.

How to Install

sudo gem install mq -s http://gemcutter.com

How to Use

Assuming you’d like to name your mq table Email, and your Mailer model is named Notifier

Generate the files necessary for your app:

./script/generate mq Email Notifier

mq requires your Mailer methods accept an email address as its first parameter, so a Mailer method should look like:

Notifier.send_email_method(email_address)

Of course, you can pass as many parameters as you’d like:

Notifier.send_email_method(email_address, some_object, some_other_object, …)

Queue an email by calling Email.queue with the name of your Notifier method as the first parameter, and the recipient email address as the second parameter, followed by anything else you’d like to pass.

Email.queue(:send_email_method, “matt@matt-darby.com”)

You can pass multiple email addresses to the Email.queue method and mq will automatically generate individual emails for the recipients.

Email.queue(:send_email_method, [“matt@matt-darby.com”, “foo@bar.com”], …)

Delivery of queued email

You can create a cronjob (this on runs every five minutes)

*/5 * * * * cd /path/to/your/app && ./script/runner/Email.deliver_all

How to Test

Complete Rspec specs are included automatically. Well, complete aside from view specs as you’ll just change the damned things anyway.

Help

Add a ticket to MQ’s Lighthouse Account

About the Author

My name is Matt Darby. I’m the Lead Web Developer and IT Manager at Dynamix Engineering and hold a Master’s Degree in Computer Science from Franklin University in Columbus, OH.

Feel free to check out my blog or to recommend me