README.rdoc in resque_mailer-0.1.0 vs README.rdoc in resque_mailer-0.2.0
- old
+ new
@@ -1,44 +1,50 @@
= ResqueMailer
A gem plugin which allows messages prepared by ActionMailer to be delivered asynchronously.
-Assumes that you are using Resque (http://github.com/defunkt/resque) for your background jobs.
+Assumes that you're using Resque (http://github.com/defunkt/resque) for your background jobs.
== Usage
Include Resque::Mailer in your ActionMailer subclass(es) like this:
-class MyMailer < ActionMailer::Base
- include Resque::Mailer
-end
+ class MyMailer < ActionMailer::Base
+ include Resque::Mailer
+ end
+Or if you want to always use asynchronous delivery by default, create an initializer in your
+Rails project or piggyback on your load_resque.rb initializer:
+
+ class ActionMailer::Base
+ include Resque::Mailer
+ end
+
Now, when MyMailer.deliver_subject_email is called, an entry will be created in the job queue.
+Your Resque workers will be able to deliver this for you; the queue we're using is imaginatively
+named +mailer+. Just make sure your workers know about it and are loading your environment:
+
+ QUEUE=mailer rake environment resque:work
+
Note that you can still have mail delivered synchronously by using the bang method variant:
MyMailer.deliver_subject_email!
-To always use asynchronous delivery by default, create an initializer in your Rails project like so:
-
-# config/initializers/resque_mailer.rb
-class ActionMailer::Base
- include Resque::Mailer
-end
-
== Installation
Install it as a plugin or as a gem plugin.
-script/plugin install git://github.com/zapnap/resque_mailer.git
+ script/plugin install git://github.com/zapnap/resque_mailer.git
-config.gem 'resque_mailer'
+ # config/environment.rb
+ config.gem 'resque_mailer'
== Testing
You don't want to be sending actual emails in the test environment, so you can configure the
-environments that should be excluded.
+environments that should be excluded like so:
-# config/initializers/resque_mailer.rb
-Resque::Mailer.excluded_environments = [:test, :cucumber]
+ # config/initializers/resque_mailer.rb
+ Resque::Mailer.excluded_environments = [:test, :cucumber]
== Note on Patches / Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
@@ -47,7 +53,7 @@
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
== Credits
-This work is basically a forked version of delayed_job_mailer http://github.com/andersondias/delayed_job_mailer) by Anderson Dias
+This work is essentially a forked version of delayed_job_mailer (http://github.com/andersondias/delayed_job_mailer) by Anderson Dias
(which in turn was inspired by Alexander Lang's workling_mailer). Enhanced and modified to work with Resque by Nick Plante.