-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
56 lines (37 loc) · 1.76 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
DelayedJobMailer
==============
This plugin provides a module which - when included into an ActionMailer subclass - pushes all emails that would
normally be delivered synchronously into a queue for asynchronous processing. For queuing it relies on the delayed_job
plugin ( http://github.com/tobi/delayed_job ).
How it works
============
The plugin provides a module Delayed::Mailer. To make a mailer use a queue simply include it into the class like this:
class MyMailer < ActionMailer::Base
include Delayed::Mailer
end
From now on all MyMailer.deliver_whatever_email calls create an entry delayed_job queue.
If you still want to deliver mail sycnhronously add a bang to the method call: MyMailer.deliver_whatever_email!
To set asynchronous mailing as project default, you need to create an initializer file as follows:
# config/initializers/delayed_mailer.rb
class ActionMailer::Base
include Delayed::Mailer
end
Installation
============
script/plugin install git://github.com/andersondias/delayed_job_mailer.git
Configuration
=============
Delayed e-mails is an awesome thing in production environments, but for e-mail specs/tests in testing environments it can be a mess causing specs/tests to fail because the e-mail haven't been sent directly. Therefore you can configure what environments that should be excluded like so:
# config/initializers/delayed_mailer.rb
Delayed::Mailer.excluded_environments = [:test, :cucumber] # etc.
...
Credits
=======
This plugin is a delayed job plugin based on langalex workling_mailer
plugin that can be found at http://github.com/langalex/workling_mailer
Contact
=======
Copyright (c) 2009 Anderson Dias, released under the MIT license
Email: andersondaraujo[at]gmail.com
Twitter: extendsmymind
Blog: http://extendsmymind.wordpress.com