Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 753 lines (705 sloc) 32.662 kb
616ebb8 José Valim Remove unused code paths and require mail only when it's needed.
josevalim authored
1 require 'mail'
a288082 Mikel Lindsaar Adding :transfer_encoding -> :content_transfer_encoding as part of Tmail...
mikel authored
2 require 'action_mailer/tmail_compat'
c985a0e Add some tests to collector with templates and any.
José Valim and Mikel Lindsaar authored
3 require 'action_mailer/collector'
41af6d9 Jeremy Kemper Use Array.wrap not Array()
jeremy authored
4 require 'active_support/core_ext/array/wrap'
76f024a Xavier Noria adds missing requires for Object#blank? and Object#present?
fxn authored
5 require 'active_support/core_ext/object/blank'
fa5f936 Santiago Pastorino Added missing require, we are using bind method defined on active_suppor...
spastorino authored
6 require 'active_support/core_ext/proc'
284ca81 Josh Kalderimis remove AM delegating register_observer and register_interceptor to Mail ...
joshk authored
7 require 'active_support/core_ext/string/inflections'
0f8a6eb Prem Sichanugrist Fix missing requires in Action Mailer
sikachu authored
8 require 'active_support/core_ext/hash/except'
6788db8 José Valim Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing fram...
josevalim authored
9 require 'action_mailer/log_subscriber'
a63caa4 Get tests to run (with failures) without old base around
Yehuda Katz + Carl Lerche authored
10
c4590d5 David Heinemeier Hansson Fixed docs
dhh authored
11 module ActionMailer #:nodoc:
98dc582 Pratik Merge docrails.
lifo authored
12 # Action Mailer allows you to send email from your application using a mailer model and views.
db045db David Heinemeier Hansson Initial
dhh authored
13 #
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
14 # = Mailer Models
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
15 #
98dc582 Pratik Merge docrails.
lifo authored
16 # To use Action Mailer, you need to create a mailer model.
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
17 #
f44a0b1 Roman Dittert fix usage examples and more to use new invocations
romdi authored
18 # $ rails generate mailer Notifier
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
19 #
058f7fe Mikel Lindsaar Cleaning up Action Mailer spelling with and without the space
mikel authored
20 # The generated model inherits from <tt>ActionMailer::Base</tt>. Emails are defined by creating methods
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
21 # within the model which are then used to set variables to be used in the mail template, to
22 # change options on the mail, or to add attachments.
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
23 #
24 # Examples:
25 #
26 # class Notifier < ActionMailer::Base
452bb1e Jeremy Kemper Rename 'defaults' class method to 'default' to reflect that it's a decla...
jeremy authored
27 # default :from => 'no-reply@example.com',
28 # :return_path => 'system@example.com'
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
29 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
30 # def welcome(recipient)
31 # @account = recipient
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
32 # mail(:to => recipient.email_address_with_name,
33 # :bcc => ["bcc@example.com", "Order Watcher <watcher@example.com>"])
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
34 # end
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
35 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
36 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
37 # Within the mailer method, you have access to the following methods:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
38 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
39 # * <tt>attachments[]=</tt> - Allows you to add attachments to your email in an intuitive
40 # manner; <tt>attachments['filename.png'] = File.read('path/to/filename.png')</tt>
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
41 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
42 # * <tt>attachments.inline[]=</tt> - Allows you to add an inline attachment to your email
43 # in the same manner as <tt>attachments[]=</tt>
44 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
45 # * <tt>headers[]=</tt> - Allows you to specify any header field in your email such
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
46 # as <tt>headers['X-No-Spam'] = 'True'</tt>. Note, while most fields like <tt>To:</tt>
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
47 # <tt>From:</tt> can only appear once in an email header, other fields like <tt>X-Anything</tt>
48 # can appear multiple times. If you want to change a field that can appear multiple times,
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
49 # you need to set it to nil first so that Mail knows you are replacing it and not adding
50 # another field of the same name.
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
51 #
9520166 Mikel Lindsaar Fixed up being able to pass random headers in with headers, or mail. Al...
mikel authored
52 # * <tt>headers(hash)</tt> - Allows you to specify multiple headers in your email such
53 # as <tt>headers({'X-No-Spam' => 'True', 'In-Reply-To' => '1234@message.id'})</tt>
54 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
55 # * <tt>mail</tt> - Allows you to specify email to be sent.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
56 #
9520166 Mikel Lindsaar Fixed up being able to pass random headers in with headers, or mail. Al...
mikel authored
57 # The hash passed to the mail method allows you to specify any header that a Mail::Message
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
58 # will accept (any valid Email header including optional fields).
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
59 #
60 # The mail method, if not passed a block, will inspect your views and send all the views with
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
61 # the same name as the method, so the above action would send the +welcome.text.plain.erb+ view
62 # file as well as the +welcome.text.html.erb+ view file in a +multipart/alternative+ email.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
63 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
64 # If you want to explicitly render only certain templates, pass a block:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
65 #
c125116 David Chelimsky docfix (email instead of emai)
dchelimsky authored
66 # mail(:to => user.email) do |format|
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
67 # format.text
68 # format.html
69 # end
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
70 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
71 # The block syntax is also useful in providing information specific to a part:
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
72 #
c125116 David Chelimsky docfix (email instead of emai)
dchelimsky authored
73 # mail(:to => user.email) do |format|
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
74 # format.text(:content_transfer_encoding => "base64")
75 # format.html
76 # end
77 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
78 # Or even to render a special view:
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
79 #
c125116 David Chelimsky docfix (email instead of emai)
dchelimsky authored
80 # mail(:to => user.email) do |format|
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
81 # format.text
82 # format.html { render "some_other_template" }
83 # end
84 #
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
85 # = Mailer views
86 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
87 # Like Action Controller, each mailer class has a corresponding view directory in which each
88 # method of the class looks for a template with its name.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
89 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
90 # To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same
91 # name as the method in your mailer model. For example, in the mailer defined above, the template at
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
92 # <tt>app/views/notifier/signup_notification.text.plain.erb</tt> would be used to generate the email.
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
93 #
94 # Variables defined in the model are accessible as instance variables in the view.
95 #
96 # Emails by default are sent in plain text, so a sample view for our model example might look like this:
97 #
98 # Hi <%= @account.name %>,
99 # Thanks for joining our service! Please check back often.
100 #
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
101 # You can even use Action Pack helpers in these views. For example:
102 #
103 # You got a new note!
ee70d1b José Valim adv_attr_accessors in ActionMailer are not sent to the views, use the ma...
josevalim authored
104 # <%= truncate(@note.body, 25) %>
105 #
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
106 # If you need to access the subject, from or the recipients in the view, you can do that through message object:
ee70d1b José Valim adv_attr_accessors in ActionMailer are not sent to the views, use the ma...
josevalim authored
107 #
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
108 # You got a new note from <%= message.from %>!
ee70d1b José Valim adv_attr_accessors in ActionMailer are not sent to the views, use the ma...
josevalim authored
109 # <%= truncate(@note.body, 25) %>
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
110 #
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
111 #
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
112 # = Generating URLs
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
113 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
114 # URLs can be generated in mailer views using <tt>url_for</tt> or named routes. Unlike controllers from
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
115 # Action Pack, the mailer instance doesn't have any context about the incoming request, so you'll need
116 # to provide all of the details needed to generate a URL.
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
117 #
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
118 # When using <tt>url_for</tt> you'll need to provide the <tt>:host</tt>, <tt>:controller</tt>, and <tt>:action</tt>:
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
119 #
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
120 # <%= url_for(:host => "example.com", :controller => "welcome", :action => "greeting") %>
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
121 #
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
122 # When using named routes you only need to supply the <tt>:host</tt>:
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
123 #
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
124 # <%= users_url(:host => "example.com") %>
125 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
126 # You want to avoid using the <tt>name_of_route_path</tt> form of named routes because it doesn't
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
127 # make sense to generate relative URLs in email messages.
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
128 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
129 # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt>
ab62aa1 Jeroen van Dijk Mention that ActionMailer::Base.default_url_options is now deprecated
jeroenvandijk authored
130 # option as a configuration option in <tt>config/application.rb</tt>:
4809dcc * Remove default_url_options from mailer generator
Cody Fauser authored
131 #
132 # config.action_mailer.default_url_options = { :host => "example.com" }
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
133 #
ab62aa1 Jeroen van Dijk Mention that ActionMailer::Base.default_url_options is now deprecated
jeroenvandijk authored
134 # Setting <tt>ActionMailer::Base.default_url_options</tt> directly is now deprecated, use the configuration
135 # option mentioned above to set the default host.
136 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
137 # If you do decide to set a default <tt>:host</tt> for your mailers you want to use the
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
138 # <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are
139 # generated because the <tt>url_for</tt> view helper will, by default, generate relative URLs when a
140 # <tt>:host</tt> option isn't explicitly provided.
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
141 #
142 # = Sending mail
143 #
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
144 # Once a mailer action and template are defined, you can deliver your message or create it and save it
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
145 # for delivery later:
146 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
147 # Notifier.welcome(david).deliver # sends the email
148 # mail = Notifier.welcome(david) # => a Mail::Message object
149 # mail.deliver # sends the email
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
150 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
151 # You never instantiate your mailer class. Rather, you just call the method you defined on the class itself.
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
152 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
153 # = Multipart Emails
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
154 #
98dc582 Pratik Merge docrails.
lifo authored
155 # Multipart messages can also be used implicitly because Action Mailer will automatically
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
156 # detect and use multipart templates, where each template is named after the name of the action, followed
157 # by the content type. Each such detected template will be added as separate part to the message.
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
158 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
159 # For example, if the following templates exist:
21187c0 David Heinemeier Hansson Apply the rest of Chads patch
dhh authored
160 # * signup_notification.text.plain.erb
161 # * signup_notification.text.html.erb
162 # * signup_notification.text.xml.builder
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
163 # * signup_notification.text.yaml.erb
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
164 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
165 # Each would be rendered and added as a separate part to the message, with the corresponding content
166 # type. The content type for the entire message is automatically set to <tt>multipart/alternative</tt>,
167 # which indicates that the email contains multiple different representations of the same email
168 # body. The same instance variables defined in the action are passed to all email templates.
359caef Jamis Buck A very thorough refactoring, resulting in new mail property setters and ...
jamis authored
169 #
46f30f9 Pratik Merge documentation changes from docrails.
lifo authored
170 # Implicit template rendering is not performed if any attachments or parts have been added to the email.
171 # This means that you'll have to manually add each part to the email and set the content type of the email
172 # to <tt>multipart/alternative</tt>.
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
173 #
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
174 # = Attachments
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
175 #
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
176 # Sending attachment in emails is easy:
0a407bc ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Mar...
Marcel Molina authored
177 #
178 # class ApplicationMailer < ActionMailer::Base
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
179 # def welcome(recipient)
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
180 # attachments['free_book.pdf'] = File.read('path/to/file.pdf')
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
181 # mail(:to => recipient, :subject => "New account information")
db045db David Heinemeier Hansson Initial
dhh authored
182 # end
3b0e1d9 Joshua Peek Prefer string core_ext inflector methods over directly accessing Inflect...
josh authored
183 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
184 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
185 # Which will (if it had both a <tt>welcome.text.plain.erb</tt> and <tt>welcome.text.html.erb</tt>
ccf9577 Ev Dolzhenko Fix a bunch of minor spelling mistakes
dolzenko authored
186 # template in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
187 # the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside,
188 # and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
189 # with the filename +free_book.pdf+.
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
190 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
191 # = Inline Attachments
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
192 #
193 # You can also specify that a file should be displayed inline with other HTML. This is useful
daad445 Neeraj Singh itsy bitsy changes to ActionMailer documentation
neerajdotname authored
194 # if you want to display a corporate logo or a photo.
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
195 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
196 # class ApplicationMailer < ActionMailer::Base
197 # def welcome(recipient)
198 # attachments.inline['photo.png'] = File.read('path/to/photo.png')
199 # mail(:to => recipient, :subject => "Here is what we look like")
200 # end
201 # end
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
202 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
203 # And then to reference the image in the view, you create a <tt>welcome.html.erb</tt> file and
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
204 # make a call to +image_tag+ passing in the attachment you want to display and then call
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
205 # +url+ on the attachment to get the relative content id path for the image source:
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
206 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
207 # <h1>Please Don't Cringe</h1>
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
208 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
209 # <%= image_tag attachments['photo.png'].url -%>
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
210 #
f17159b Xavier Noria edit pass: the names of Rails components have a space, ie, "Active Recor...
fxn authored
211 # As we are using Action View's +image_tag+ method, you can pass in any other options you want:
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
212 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
213 # <h1>Please Don't Cringe</h1>
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
214 #
3762362 Mikel Lindsaar Updating readme for ActionMailer::Base
mikel authored
215 # <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%>
b451de0 Santiago Pastorino Deletes trailing whitespaces (over text files only find * -type f -exec ...
spastorino authored
216 #
cefc136 Mikel Lindsaar Adding options to register observers and interceptors through ActionMail...
mikel authored
217 # = Observing and Intercepting Mails
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
218 #
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
219 # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
cefc136 Mikel Lindsaar Adding options to register observers and interceptors through ActionMail...
mikel authored
220 # register objects that are called during the mail delivery life cycle.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
221 #
cefc136 Mikel Lindsaar Adding options to register observers and interceptors through ActionMail...
mikel authored
222 # An observer object must implement the <tt>:delivered_email(message)</tt> method which will be
223 # called once for every email sent after the email has been sent.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
224 #
cefc136 Mikel Lindsaar Adding options to register observers and interceptors through ActionMail...
mikel authored
225 # An interceptor object must implement the <tt>:delivering_email(message)</tt> method which will be
226 # called before the email is sent, allowing you to make modifications to the email before it hits
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
227 # the delivery agents. Your object should make any needed modifications directly to the passed
cefc136 Mikel Lindsaar Adding options to register observers and interceptors through ActionMail...
mikel authored
228 # in Mail::Message instance.
20bd4bd David Heinemeier Hansson Updated docs and otherwise
dhh authored
229 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
230 # = Default Hash
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
231 #
058f7fe Mikel Lindsaar Cleaning up Action Mailer spelling with and without the space
mikel authored
232 # Action Mailer provides some intelligent defaults for your emails, these are usually specified in a
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
233 # default method inside the class definition:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
234 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
235 # class Notifier < ActionMailer::Base
236 # default :sender => 'system@example.com'
237 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
238 #
ad8e1ba Cheah Chu Yeow Fix missing word in ActionMailer::Base documentation.
chuyeow authored
239 # You can pass in any header value that a <tt>Mail::Message</tt> accepts. Out of the box,
240 # <tt>ActionMailer::Base</tt> sets the following:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
241 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
242 # * <tt>:mime_version => "1.0"</tt>
243 # * <tt>:charset => "UTF-8",</tt>
244 # * <tt>:content_type => "text/plain",</tt>
245 # * <tt>:parts_order => [ "text/plain", "text/enriched", "text/html" ]</tt>
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
246 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
247 # <tt>parts_order</tt> and <tt>charset</tt> are not actually valid <tt>Mail::Message</tt> header fields,
058f7fe Mikel Lindsaar Cleaning up Action Mailer spelling with and without the space
mikel authored
248 # but Action Mailer translates them appropriately and sets the correct values.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
249 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
250 # As you can pass in any header, you need to either quote the header as a string, or pass it in as
b72cd29 Mikel Lindsaar Fixing spelling
mikel authored
251 # an underscored symbol, so the following will work:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
252 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
253 # class Notifier < ActionMailer::Base
254 # default 'Content-Transfer-Encoding' => '7bit',
255 # :content_description => 'This is a description'
256 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
257 #
058f7fe Mikel Lindsaar Cleaning up Action Mailer spelling with and without the space
mikel authored
258 # Finally, Action Mailer also supports passing <tt>Proc</tt> objects into the default hash, so you
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
259 # can define methods that evaluate as the message is being generated:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
260 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
261 # class Notifier < ActionMailer::Base
262 # default 'X-Special-Header' => Proc.new { my_method }
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
263 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
264 # private
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
265 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
266 # def my_method
267 # 'some complex call'
268 # end
269 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
270 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
271 # Note that the proc is evaluated right at the start of the mail message generation, so if you
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
272 # set something in the defaults using a proc, and then set the same thing inside of your
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
273 # mailer method, it will get over written by the mailer method.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
274 #
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
275 # = Configuration options
276 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
277 # These options are specified on the class level, like
e968acc Ryan Bigg Update ActionMailer documentation to not use deprecated template_root me...
radar authored
278 # <tt>ActionMailer::Base.raise_delivery_errors = true</tt>
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
279 #
fb30feb Mikel Lindsaar Adding more docs to ActionMailer
mikel authored
280 # * <tt>default</tt> - You can pass this in at a class level as well as within the class itself as
281 # per the above section.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
282 #
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
283 # * <tt>logger</tt> - the logger is used for generating information on the mailing run if available.
284 # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
285 #
64092de Xavier Noria Improve documentation coverage and markup
fxn authored
286 # * <tt>smtp_settings</tt> - Allows detailed configuration for <tt>:smtp</tt> delivery method:
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
287 # * <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default
288 # "localhost" setting.
dc4eec1 Pratik Merge docrails:
lifo authored
289 # * <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
290 # * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
291 # * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
292 # * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
293 # * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the
294 # authentication type here.
5a898e1 Explain actionamailer authentication types
Peter Baker authored
295 # This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
3457db7 Dalibor Nasevic Correct spelling for Base64 in action_mailer
dalibor authored
296 # send password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
5a898e1 Explain actionamailer authentication types
Peter Baker authored
297 # information and a cryptographic Message Digest 5 algorithm to hash important information)
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
298 # * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
299 # and starts to use it.
a1639ad Florent Piteau Undocumented :openssl_verify_mode option for smtp_settings
flop authored
300 # * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
301 # really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
302 # of an OpenSSL verify constant ('none', 'peer', 'client_once','fail_if_no_peer_cert') or directly the
303 # constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER,...).
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
304 #
46f30f9 Pratik Merge documentation changes from docrails.
lifo authored
305 # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
306 # * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
b72cd29 Mikel Lindsaar Fixing spelling
mikel authored
307 # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@address</tt>
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
308 # added automatically before the message is sent.
dc4eec1 Pratik Merge docrails:
lifo authored
309 #
fbe6c3c Eric Davis Adds a :file delivery_method to save email to a file on disk
edavis10 authored
310 # * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
311 # * <tt>:location</tt> - The directory into which emails will be written. Defaults to the application
312 # <tt>tmp/mails</tt>.
fbe6c3c Eric Davis Adds a :file delivery_method to save email to a file on disk
edavis10 authored
313 #
dc4eec1 Pratik Merge docrails:
lifo authored
314 # * <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
315 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
316 # * <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default),
317 # <tt>:sendmail</tt>, <tt>:test</tt>, and <tt>:file</tt>. Or you may provide a custom delivery method
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
318 # object eg. MyOwnDeliveryMethodClass.new. See the Mail gem documentation on the interface you need to
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
319 # implement for a custom delivery agent.
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
320 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
321 # * <tt>perform_deliveries</tt> - Determines whether emails are actually sent from Action Mailer when you
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
322 # call <tt>.deliver</tt> on an mail message or on an Action Mailer method. This is on by default but can
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
323 # be turned off to aid in functional testing.
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
324 #
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
325 # * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
326 # <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
af56c80 David Heinemeier Hansson Updated documentation
dhh authored
327 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
328 # * <tt>default_charset</tt> - This is now deprecated, use the +default+ method above to
21dcc20 Mikel Lindsaar Fixed up documentation to reflect code change and cleaned up tests of sp...
mikel authored
329 # set the default +:charset+.
c2e7851 José Valim Add ActionMailer::Base#enable_starttls_auto option for enabling/disablin...
josevalim authored
330 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
331 # * <tt>default_content_type</tt> - This is now deprecated, use the +default+ method above
21dcc20 Mikel Lindsaar Fixed up documentation to reflect code change and cleaned up tests of sp...
mikel authored
332 # to set the default +:content_type+.
c2e7851 José Valim Add ActionMailer::Base#enable_starttls_auto option for enabling/disablin...
josevalim authored
333 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
334 # * <tt>default_mime_version</tt> - This is now deprecated, use the +default+ method above
21dcc20 Mikel Lindsaar Fixed up documentation to reflect code change and cleaned up tests of sp...
mikel authored
335 # to set the default +:mime_version+.
c2e7851 José Valim Add ActionMailer::Base#enable_starttls_auto option for enabling/disablin...
josevalim authored
336 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
337 # * <tt>default_implicit_parts_order</tt> - This is now deprecated, use the +default+ method above
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
338 # to set the default +:parts_order+. Parts Order is used when a message is built implicitly
21dcc20 Mikel Lindsaar Fixed up documentation to reflect code change and cleaned up tests of sp...
mikel authored
339 # (i.e. multiple parts are assembled from templates which specify the content type in their
340 # filenames) this variable controls how the parts are ordered.
4964d3b José Valim Make ActionMailer::Base inherit from AbstractController::Base
josevalim authored
341 class Base < AbstractController::Base
dbcf01e Mikel Lindsaar Removing quoting.rb, upgrade to 2.1.3.6, changing all utf-8 references t...
mikel authored
342 include DeliveryMethods
f30d73b Add new class delivery method API.
José Valim and Mikel Lindsaar authored
343 abstract!
344
c03c40b José Valim Expose a _render_partial hook as thhe _render_template one and make use ...
josevalim authored
345 include AbstractController::Logger
83f4d86 David Heinemeier Hansson Rename the RenderingController module to just plain Rendering
dhh authored
346 include AbstractController::Rendering
a9751a7 José Valim Refactor ActionMailer layout and remove legacy one.
josevalim authored
347 include AbstractController::Layouts
684c2dc José Valim Remove ActionMailer helpers and rely on AbstractController one.
josevalim authored
348 include AbstractController::Helpers
48a3985 José Valim Also include translation in ActionMailer.
josevalim authored
349 include AbstractController::Translation
08baa34 David Heinemeier Hansson Extract assets paths and make them available to Action Mailer as well
dhh authored
350 include AbstractController::AssetPaths
359caef Jamis Buck A very thorough refactoring, resulting in new mail property setters and ...
jamis authored
351
d42bb68 José Valim More updates to ivars list.
josevalim authored
352 self.protected_instance_variables = %w(@_action_has_layout)
353
972efa1 José Valim Deprecate the old mailer API that was not deprecated yet.
josevalim authored
354 helper ActionMailer::MailHelper
5dead5b Maintain old_api and deprecated_api in different files.
José Valim and Mikel Lindsaar authored
355 include ActionMailer::OldApi
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
356
c927aa0 David Heinemeier Hansson Updated documentation
dhh authored
357 private_class_method :new #:nodoc:
db045db David Heinemeier Hansson Initial
dhh authored
358
e5ab4b0 Jeremy Kemper Convert to class_attribute
jeremy authored
359 class_attribute :default_params
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
360 self.default_params = {
361 :mime_version => "1.0",
dbcf01e Mikel Lindsaar Removing quoting.rb, upgrade to 2.1.3.6, changing all utf-8 references t...
mikel authored
362 :charset => "UTF-8",
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
363 :content_type => "text/plain",
364 :parts_order => [ "text/plain", "text/enriched", "text/html" ]
e5ab4b0 Jeremy Kemper Convert to class_attribute
jeremy authored
365 }.freeze
e1c1318 Added delivers_from.
José Valim and Mikel Lindsaar authored
366
eda1719 Jamis Buck ActionMailer::Base.deliver(email) had been accidentally removed, but was...
jamis authored
367 class << self
284ca81 Josh Kalderimis remove AM delegating register_observer and register_interceptor to Mail ...
joshk authored
368 # Register one or more Observers which will be notified when mail is delivered.
369 def register_observers(*observers)
370 observers.flatten.compact.each { |observer| register_observer(observer) }
371 end
372
373 # Register one or more Interceptors which will be called before mail is sent.
374 def register_interceptors(*interceptors)
375 interceptors.flatten.compact.each { |interceptor| register_interceptor(interceptor) }
376 end
377
378 # Register an Observer which will be notified when mail is delivered.
379 # Either a class or a string can be passed in as the Observer. If a string is passed in
380 # it will be <tt>constantize</tt>d.
381 def register_observer(observer)
cb9e501 Josh Kalderimis AM register_interceptor and register_observer only constantize if the ar...
joshk authored
382 delivery_observer = (observer.is_a?(String) ? observer.constantize : observer)
284ca81 Josh Kalderimis remove AM delegating register_observer and register_interceptor to Mail ...
joshk authored
383 Mail.register_observer(delivery_observer)
384 end
385
386 # Register an Inteceptor which will be called before mail is sent.
387 # Either a class or a string can be passed in as the Observer. If a string is passed in
388 # it will be <tt>constantize</tt>d.
389 def register_interceptor(interceptor)
cb9e501 Josh Kalderimis AM register_interceptor and register_observer only constantize if the ar...
joshk authored
390 delivery_interceptor = (interceptor.is_a?(String) ? interceptor.constantize : interceptor)
284ca81 Josh Kalderimis remove AM delegating register_observer and register_interceptor to Mail ...
joshk authored
391 Mail.register_interceptor(delivery_interceptor)
392 end
393
bd5ed65 risk danger olson Update ActionMailer so it treats ActionView the same way that ActionCont...
technoweenie authored
394 def mailer_name
395 @mailer_name ||= name.underscore
396 end
0750304 Mikel Lindsaar Migrated over to Mail doing delivery.
mikel authored
397 attr_writer :mailer_name
398 alias :controller_path :mailer_name
81c416b José Valim More refactoring on ActionMailer::Base.
josevalim authored
399
e5ab4b0 Jeremy Kemper Convert to class_attribute
jeremy authored
400 def default(value = nil)
401 self.default_params = default_params.merge(value).freeze if value
402 default_params
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
403 end
404
59f1df1 Jamis Buck Update/extend ActionMailer documentation (rdoc)
jamis authored
405 # Receives a raw email, parses it into an email object, decodes it,
406 # instantiates a new mailer, and passes the email object to the mailer
98dc582 Pratik Merge docrails.
lifo authored
407 # object's +receive+ method. If you want your mailer to be able to
408 # process incoming messages, you'll need to implement a +receive+
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
409 # method that accepts the raw email string as a parameter:
59f1df1 Jamis Buck Update/extend ActionMailer documentation (rdoc)
jamis authored
410 #
411 # class MyMailer < ActionMailer::Base
412 # def receive(mail)
413 # ...
414 # end
415 # end
704daad José Valim Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
josevalim authored
416 def receive(raw_mail)
731d439 Justin George Change event namespace ordering to most-significant first [#4504 state:r...
jaggederest authored
417 ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
704daad José Valim Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
josevalim authored
418 mail = Mail.new(raw_mail)
419 set_payload_for_mail(payload, mail)
2a6bc12 José Valim Add subscriber to ActionMailer.
josevalim authored
420 new.receive(mail)
421 end
eda1719 Jamis Buck ActionMailer::Base.deliver(email) had been accidentally removed, but was...
jamis authored
422 end
423
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
424 # Wraps an email delivery inside of Active Support Notifications instrumentation. This
de65c82 Rizwan Reza Changes call backs to callbacks.
rizwanreza authored
425 # method is actually called by the <tt>Mail::Message</tt> object itself through a callback
bb2c7b4 Mikel Lindsaar Updating Action Mailer documentation
mikel authored
426 # when you call <tt>:deliver</tt> on the Mail::Message, calling +deliver_mail+ directly
427 # and passing a Mail::Message will do nothing except tell the logger you sent the email.
e4a989e Added delivery_handler method to mail and implemented in ActionMailer to...
José Valim and Mikel Lindsaar authored
428 def deliver_mail(mail) #:nodoc:
731d439 Justin George Change event namespace ordering to most-significant first [#4504 state:r...
jaggederest authored
429 ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload|
258ca14 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added callba...
José Valim and Mikel Lindsaar authored
430 self.set_payload_for_mail(payload, mail)
ace7497 Got AM working with Mail yield on delivery_handler and updated tests
José Valim and Mikel Lindsaar authored
431 yield # Let Mail do the delivery actions
258ca14 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added callba...
José Valim and Mikel Lindsaar authored
432 end
433 end
434
ad8dc5a Mikel Lindsaar Should use standard ruby signature for respond_to
mikel authored
435 def respond_to?(method, include_private = false) #:nodoc:
99f960a Handle some TODOs and deprecations.
José Valim and Mikel Lindsaar authored
436 super || action_methods.include?(method.to_s)
437 end
438
439 protected
440
704daad José Valim Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
josevalim authored
441 def set_payload_for_mail(payload, mail) #:nodoc:
e8c9cac Aaron Patterson self is implied, so remove self
tenderlove authored
442 payload[:mailer] = name
c905fce José Valim Add message_id to AM payload and don't send bcc and cc if they were not ...
josevalim authored
443 payload[:message_id] = mail.message_id
444 payload[:subject] = mail.subject
445 payload[:to] = mail.to
446 payload[:from] = mail.from
447 payload[:bcc] = mail.bcc if mail.bcc.present?
448 payload[:cc] = mail.cc if mail.cc.present?
449 payload[:date] = mail.date
450 payload[:mail] = mail.encoded
704daad José Valim Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
josevalim authored
451 end
f30d73b Add new class delivery method API.
José Valim and Mikel Lindsaar authored
452
99f960a Handle some TODOs and deprecations.
José Valim and Mikel Lindsaar authored
453 def method_missing(method, *args) #:nodoc:
4d7b2ee Aaron Patterson dry up method missing
tenderlove authored
454 return super unless respond_to?(method)
455 new(method, *args).message
f30d73b Add new class delivery method API.
José Valim and Mikel Lindsaar authored
456 end
eda1719 Jamis Buck ActionMailer::Base.deliver(email) had been accidentally removed, but was...
jamis authored
457 end
458
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
459 attr_internal :message
460
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
461 # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
462 # will be initialized according to the named method. If not, the mailer will
463 # remain uninitialized (useful when you only need to invoke the "receive"
464 # method, for instance).
465 def initialize(method_name=nil, *args)
466 super()
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
467 @_message = Mail.new
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
468 process(method_name, *args) if method_name
469 end
470
3fc609e José Valim Fix ActionMailer test broken in 99d54599215c2a8cea7e57f609e8e578043d71b2
josevalim authored
471 def process(*args) #:nodoc:
472 lookup_context.skip_default_locale!
473 super
474 end
475
972efa1 José Valim Deprecate the old mailer API that was not deprecated yet.
josevalim authored
476 def mailer_name
477 self.class.mailer_name
478 end
479
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
480 # Allows you to pass random and unusual headers to the new +Mail::Message+ object
481 # which will add them to itself.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
482 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
483 # headers['X-Special-Domain-Specific-Header'] = "SecretValue"
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
484 #
9520166 Mikel Lindsaar Fixed up being able to pass random headers in with headers, or mail. Al...
mikel authored
485 # You can also pass a hash into headers of header field names and values, which
486 # will then be set on the Mail::Message object:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
487 #
05c4ad9 Tidy up tests and docs.
José Valim and Mikel Lindsaar authored
488 # headers 'X-Special-Domain-Specific-Header' => "SecretValue",
489 # 'In-Reply-To' => incoming.message_id
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
490 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
491 # The resulting Mail::Message will have the following in it's header:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
492 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
493 # X-Special-Domain-Specific-Header: SecretValue
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
494 def headers(args=nil)
495 if args
9520166 Mikel Lindsaar Fixed up being able to pass random headers in with headers, or mail. Al...
mikel authored
496 @_message.headers(args)
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
497 else
498 @_message
499 end
500 end
c34cfcc Mikel Lindsaar Created mail method for new API
mikel authored
501
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
502 # Allows you to add attachments to an email, like so:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
503 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
504 # mail.attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
505 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
506 # If you do this, then Mail will take the file name and work out the mime type
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
507 # set the Content-Type, Content-Disposition, Content-Transfer-Encoding and
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
508 # base64 encode the contents of the attachment all for you.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
509 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
510 # You can also specify overrides if you want by passing a hash instead of a string:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
511 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
512 # mail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
513 # :content => File.read('/path/to/filename.jpg')}
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
514 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
515 # If you want to use a different encoding than Base64, you can pass an encoding in,
516 # but then it is up to you to pass in the content pre-encoded, and don't expect
517 # Mail to know how to decode this data:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
518 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
519 # file_content = SpecialEncode(File.read('/path/to/filename.jpg'))
520 # mail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
521 # :encoding => 'SpecialEncoding',
522 # :content => file_content }
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
523 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
524 # You can also search for specific attachments:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
525 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
526 # # By Filename
755af49 Xavier Noria edit pass to apply API guideline wrt the use of "# =>" in example code
fxn authored
527 # mail.attachments['filename.jpg'] # => Mail::Part object or nil
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
528 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
529 # # or by index
755af49 Xavier Noria edit pass to apply API guideline wrt the use of "# =>" in example code
fxn authored
530 # mail.attachments[0] # => Mail::Part (first attachment)
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
531 #
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
532 def attachments
533 @_message.attachments
534 end
dcb9253 Add basic template rendering to new DSL.
José Valim and Mikel Lindsaar authored
535
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
536 # The main method that creates the message and renders the email templates. There are
537 # two ways to call this method, with a block, or without a block.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
538 #
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
539 # Both methods accept a headers hash. This hash allows you to specify the most used headers
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
540 # in an email message, these are:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
541 #
058f7fe Mikel Lindsaar Cleaning up Action Mailer spelling with and without the space
mikel authored
542 # * <tt>:subject</tt> - The subject of the message, if this is omitted, Action Mailer will
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
543 # ask the Rails I18n class for a translated <tt>:subject</tt> in the scope of
544 # <tt>[:actionmailer, mailer_scope, action_name]</tt> or if this is missing, will translate the
545 # humanized version of the <tt>action_name</tt>
546 # * <tt>:to</tt> - Who the message is destined for, can be a string of addresses, or an array
547 # of addresses.
0b05acd Mikel Lindsaar Implementing class level :defaults hash, instead of delivers_from et al
mikel authored
548 # * <tt>:from</tt> - Who the message is from
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
549 # * <tt>:cc</tt> - Who you would like to Carbon-Copy on this email, can be a string of addresses,
550 # or an array of addresses.
551 # * <tt>:bcc</tt> - Who you would like to Blind-Carbon-Copy on this email, can be a string of
552 # addresses, or an array of addresses.
553 # * <tt>:reply_to</tt> - Who to set the Reply-To header of the email to.
554 # * <tt>:date</tt> - The date to say the email was sent on.
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
555 #
556 # You can set default values for any of the above headers (except :date) by using the <tt>default</tt>
0b05acd Mikel Lindsaar Implementing class level :defaults hash, instead of delivers_from et al
mikel authored
557 # class method:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
558 #
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
559 # class Notifier < ActionMailer::Base
452bb1e Jeremy Kemper Rename 'defaults' class method to 'default' to reflect that it's a decla...
jeremy authored
560 # self.default :from => 'no-reply@test.lindsaar.net',
561 # :bcc => 'email_logger@test.lindsaar.net',
562 # :reply_to => 'bounces@test.lindsaar.net'
0b05acd Mikel Lindsaar Implementing class level :defaults hash, instead of delivers_from et al
mikel authored
563 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
564 #
52c56f9 Greg Hurrell docs: note that mail() accepts arbitrary headers
wincent authored
565 # If you need other headers not listed above, you can either pass them in
566 # as part of the headers hash or use the <tt>headers['name'] = value</tt>
567 # method.
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
568 #
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
569 # When a <tt>:return_path</tt> is specified as header, that value will be used as the 'envelope from'
5d0d4d8 Sebastian Martinez Remove extra white spaces on ActionMailer docs.
smartinez87 authored
570 # address for the Mail message. Setting this is useful when you want delivery notifications
571 # sent to a different address than the one in <tt>:from</tt>. Mail will actually use the
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
572 # <tt>:return_path</tt> in preference to the <tt>:sender</tt> in preference to the <tt>:from</tt>
573 # field for the 'envelope from' value.
574 #
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
575 # If you do not pass a block to the +mail+ method, it will find all templates in the
be35a15 José Valim Allow to choose the template path and template name used in implicit ren...
josevalim authored
576 # view paths using by default the mailer name and the method name that it is being
577 # called from, it will then create parts for each of these templates intelligently,
578 # making educated guesses on correct content type and sequence, and return a fully
579 # prepared Mail::Message ready to call <tt>:deliver</tt> on to send.
580 #
581 # For example:
582 #
583 # class Notifier < ActionMailer::Base
584 # default :from => 'no-reply@test.lindsaar.net',
585 #
586 # def welcome
587 # mail(:to => 'mikel@test.lindsaar.net')
588 # end
589 # end
590 #
591 # Will look for all templates at "app/views/notifier" with name "welcome". However, those
592 # can be customized:
593 #
594 # mail(:template_path => 'notifications', :template_name => 'another')
595 #
596 # And now it will look for all templates at "app/views/notifications" with name "another".
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
597 #
598 # If you do pass a block, you can render specific templates of your choice:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
599 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
600 # mail(:to => 'mikel@test.lindsaar.net') do |format|
601 # format.text
602 # format.html
603 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
604 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
605 # You can even render text directly without using a template:
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
606 #
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
607 # mail(:to => 'mikel@test.lindsaar.net') do |format|
608 # format.text { render :text => "Hello Mikel!" }
609 # format.html { render :text => "<h1>Hello Mikel!</h1>" }
610 # end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
611 #
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
612 # Which will render a <tt>multipart/alternative</tt> email with <tt>text/plain</tt> and
4a6eba3 Added initial documentation for the new API
José Valim and Mikel Lindsaar authored
613 # <tt>text/html</tt> parts.
6589976 Remove old files, add some information to docs and improve test suite.
José Valim and Mikel Lindsaar authored
614 #
615 # The block syntax also allows you to customize the part headers if desired:
616 #
617 # mail(:to => 'mikel@test.lindsaar.net') do |format|
618 # format.text(:content_transfer_encoding => "base64")
619 # format.html
620 # end
621 #
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
622 def mail(headers={}, &block)
623 # Guard flag to prevent both the old and the new API from firing
624 # Should be removed when old API is removed
625 @mail_was_called = true
626 m = @_message
258ca14 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added callba...
José Valim and Mikel Lindsaar authored
627
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
628 # At the beginning, do not consider class default for parts order neither content_type
629 content_type = headers[:content_type]
630 parts_order = headers[:parts_order]
1cd5592 First work on implicit multipart.
José Valim and Mikel Lindsaar authored
631
08b07b6 Mikel Lindsaar Adding ability to pass proc's to the ActionMailer class default method
mikel authored
632 # Call all the procs (if any)
633 default_values = self.class.default.merge(self.class.default) do |k,v|
ceaa100 Mikel Lindsaar Adding ability for the procs to be called within the instance, allows yo...
mikel authored
634 v.respond_to?(:call) ? v.bind(self).call : v
08b07b6 Mikel Lindsaar Adding ability to pass proc's to the ActionMailer class default method
mikel authored
635 end
458f571 Yehuda Katz Remove the need for a special action_mailer.url_for initializer that loa...
wycats authored
636
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
637 # Handle defaults
08b07b6 Mikel Lindsaar Adding ability to pass proc's to the ActionMailer class default method
mikel authored
638 headers = headers.reverse_merge(default_values)
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
639 headers[:subject] ||= default_i18n_subject
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
640
641 # Apply charset at the beginning so all fields are properly quoted
642 m.charset = charset = headers[:charset]
643
644 # Set configure delivery behavior
645 wrap_delivery_behavior!(headers.delete(:delivery_method))
646
647 # Assign all headers except parts_order, content_type and body
b4fd5e6 José Valim template_name and template_path should not be added to mail headers.
josevalim authored
648 assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path)
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
649 assignable.each { |k, v| m[k] = v }
951397b Get implicit multipart and attachments working together.
José Valim and Mikel Lindsaar authored
650
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
651 # Render the templates and blocks
39a1b06 Deprecate old defaults API.
José Valim and Mikel Lindsaar authored
652 responses, explicit_order = collect_responses_and_parts_order(headers, &block)
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
653 create_parts_from_responses(m, responses)
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
654
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
655 # Setup content type, reapply charset and handle parts order
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
656 m.content_type = set_content_type(m, content_type, headers[:content_type])
951397b Get implicit multipart and attachments working together.
José Valim and Mikel Lindsaar authored
657 m.charset = charset
658
e7e4ed4 Set sort order for explicit parts from the collector's template sequence
José Valim and Mikel Lindsaar authored
659 if m.multipart?
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
660 parts_order ||= explicit_order || headers[:parts_order]
661 m.body.set_sort_order(parts_order)
951397b Get implicit multipart and attachments working together.
José Valim and Mikel Lindsaar authored
662 m.body.sort_parts!
663 end
bb9d71f Move class methods to deprecated stuff.
José Valim and Mikel Lindsaar authored
664
c34cfcc Mikel Lindsaar Created mail method for new API
mikel authored
665 m
666 end
667
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
668 protected
669
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
670 def set_content_type(m, user_content_type, class_default)
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
671 params = m.content_type_parameters || {}
672 case
673 when user_content_type.present?
674 user_content_type
675 when m.has_attachments?
311d99e Mikel Lindsaar Adding inline attachment support to ActionMailer
mikel authored
676 if m.attachments.detect { |a| a.inline? }
677 ["multipart", "related", params]
678 else
679 ["multipart", "mixed", params]
680 end
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
681 when m.multipart?
682 ["multipart", "alternative", params]
683 else
b6b3db6 Mikel Lindsaar Fixed bug on HTML only emails getting set to text/plain
mikel authored
684 m.content_type || class_default
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
685 end
686 end
687
082e299 Sebastian Martinez docs for ActionMailer::Base.default_i18n_subject
smartinez87 authored
688 # Translates the +subject+ using Rails I18n class under <tt>[:actionmailer, mailer_scope, action_name]</tt> scope.
689 # If it does not find a translation for the +subject+ under the specified scope it will default to a
690 # humanized version of the <tt>action_name</tt>.
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
691 def default_i18n_subject #:nodoc:
5c3ef8c Refactor subject with i18n.
José Valim and Mikel Lindsaar authored
692 mailer_scope = self.class.mailer_name.gsub('/', '.')
30eaecb José Valim subject is automatically looked up on I18n using mailer_name and action_...
josevalim authored
693 I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
5c3ef8c Refactor subject with i18n.
José Valim and Mikel Lindsaar authored
694 end
695
39a1b06 Deprecate old defaults API.
José Valim and Mikel Lindsaar authored
696 def collect_responses_and_parts_order(headers) #:nodoc:
697 responses, parts_order = [], nil
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
698
699 if block_given?
a09e992 José Valim Ensure details are frozen after @details_keys lookup. The implementation...
josevalim authored
700 collector = ActionMailer::Collector.new(lookup_context) { render(action_name) }
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
701 yield(collector)
39a1b06 Deprecate old defaults API.
José Valim and Mikel Lindsaar authored
702 parts_order = collector.responses.map { |r| r[:content_type] }
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
703 responses = collector.responses
704 elsif headers[:body]
705 responses << {
be35a15 José Valim Allow to choose the template path and template name used in implicit ren...
josevalim authored
706 :body => headers.delete(:body),
452bb1e Jeremy Kemper Rename 'defaults' class method to 'default' to reflect that it's a decla...
jeremy authored
707 :content_type => self.class.default[:content_type] || "text/plain"
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
708 }
709 else
be35a15 José Valim Allow to choose the template path and template name used in implicit ren...
josevalim authored
710 templates_path = headers.delete(:template_path) || self.class.mailer_name
711 templates_name = headers.delete(:template_name) || action_name
712
713 each_template(templates_path, templates_name) do |template|
f28d856 José Valim Improve performance of the rendering stack by freezing formats as a sign...
josevalim authored
714 self.formats = template.formats
715
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
716 responses << {
2a12686 José Valim Allow anything that responds to render to be given as :template and use ...
josevalim authored
717 :body => render(:template => template),
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
718 :content_type => template.mime_type.to_s
719 }
720 end
721 end
722
39a1b06 Deprecate old defaults API.
José Valim and Mikel Lindsaar authored
723 [responses, parts_order]
7409b73 Some refactoring.
José Valim and Mikel Lindsaar authored
724 end
725
be35a15 José Valim Allow to choose the template path and template name used in implicit ren...
josevalim authored
726 def each_template(paths, name, &block) #:nodoc:
7c568fd Yehuda Katz A bunch of cleanup on the inherited template patch
wycats authored
727 templates = lookup_context.find_all(name, Array.wrap(paths))
728 templates.uniq_by { |t| t.formats }.each(&block)
99f960a Handle some TODOs and deprecations.
José Valim and Mikel Lindsaar authored
729 end
730
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
731 def create_parts_from_responses(m, responses) #:nodoc:
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
732 if responses.size == 1 && !m.has_attachments?
9dd65c3 Make defaults accept a hash.
José Valim and Mikel Lindsaar authored
733 responses[0].each { |k,v| m[k] = v }
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
734 elsif responses.size > 1 && m.has_attachments?
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
735 container = Mail::Part.new
74a5889 Refactor content type setting, added tests to ensure boundary exists on ...
José Valim and Mikel Lindsaar authored
736 container.content_type = "multipart/alternative"
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
737 responses.each { |r| insert_part(container, r, m.charset) }
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
738 m.add_part(container)
739 else
b5f9a9f José Valim Move set_fields! to the old API module.
josevalim authored
740 responses.each { |r| insert_part(m, r, m.charset) }
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
741 end
359caef Jamis Buck A very thorough refactoring, resulting in new mail property setters and ...
jamis authored
742 end
743
6ba9446 Make implicit and explicit templates pass through the same part creation...
José Valim and Mikel Lindsaar authored
744 def insert_part(container, response, charset) #:nodoc:
745 response[:charset] ||= charset
746 part = Mail::Part.new(response)
747 container.add_part(part)
359caef Jamis Buck A very thorough refactoring, resulting in new mail property setters and ...
jamis authored
748 end
3fad0cd David Heinemeier Hansson Added support for charsets for both subject and body. The default charse...
dhh authored
749
ef5dada Natalie Weizenbaum Only run load hooks once a file has been fully loaded.
nex3 authored
750 ActiveSupport.run_load_hooks(:action_mailer, self)
db045db David Heinemeier Hansson Initial
dhh authored
751 end
752 end
Something went wrong with that request. Please try again.