Skip to content
This repository
Newer
Older
100644 784 lines (736 sloc) 33.614 kb
616ebb8f » josevalim
2009-12-28 Remove unused code paths and require mail only when it's needed.
1 require 'mail'
c985a0ee » José Valim and Mikel Lindsaar
2010-01-23 Add some tests to collector with templates and any.
2 require 'action_mailer/collector'
76f024ac » fxn
2010-03-28 adds missing requires for Object#blank? and Object#present?
3 require 'active_support/core_ext/object/blank'
284ca810 » joshk
2011-04-02 remove AM delegating register_observer and register_interceptor to Ma…
4 require 'active_support/core_ext/string/inflections'
0f8a6ebb » sikachu
2011-04-14 Fix missing requires in Action Mailer
5 require 'active_support/core_ext/hash/except'
c17d200e » lest
2012-05-13 mailer can be anonymous
6 require 'active_support/core_ext/module/anonymous'
6788db82 » josevalim
2010-06-24 Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing f…
7 require 'action_mailer/log_subscriber'
a63caa4c » Yehuda Katz + Carl Lerche
2009-06-15 Get tests to run (with failures) without old base around
8
c4590d57 » dhh
2006-03-28 Fixed docs
9 module ActionMailer #:nodoc:
98dc5827 » lifo
2008-05-25 Merge docrails.
10 # Action Mailer allows you to send email from your application using a mailer model and views.
db045dbb » dhh
2004-11-24 Initial
11 #
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
12 # = Mailer Models
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
13 #
98dc5827 » lifo
2008-05-25 Merge docrails.
14 # To use Action Mailer, you need to create a mailer model.
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
15 #
f44a0b1d » romdi
2010-02-06 fix usage examples and more to use new invocations
16 # $ rails generate mailer Notifier
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
17 #
c291195a » seebq
2012-03-19 Updates ActionMailer Base summary and fixes space in code example.
18 # The generated model inherits from <tt>ActionMailer::Base</tt>. A mailer model defines methods
19 # used to generate an email message. In these methods, you can setup variables to be used in
20 # the mailer views, options on the mail itself such as the <tt>:from</tt> address, and attachments.
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
21 #
22 # Examples:
23 #
0f0213f4 » siong1987
2011-05-28 minor spacing fix in code example in ActionMailer::Base.
24 # class Notifier < ActionMailer::Base
25 # default :from => 'no-reply@example.com',
c291195a » seebq
2012-03-19 Updates ActionMailer Base summary and fixes space in code example.
26 # :return_path => 'system@example.com'
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
27 #
0f0213f4 » siong1987
2011-05-28 minor spacing fix in code example in ActionMailer::Base.
28 # def welcome(recipient)
29 # @account = recipient
30 # mail(:to => recipient.email_address_with_name,
31 # :bcc => ["bcc@example.com", "Order Watcher <watcher@example.com>"])
32 # end
33 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
34 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
35 # Within the mailer method, you have access to the following methods:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
36 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
37 # * <tt>attachments[]=</tt> - Allows you to add attachments to your email in an intuitive
38 # manner; <tt>attachments['filename.png'] = File.read('path/to/filename.png')</tt>
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
39 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
40 # * <tt>attachments.inline[]=</tt> - Allows you to add an inline attachment to your email
41 # in the same manner as <tt>attachments[]=</tt>
42 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
43 # * <tt>headers[]=</tt> - Allows you to specify any header field in your email such
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
44 # as <tt>headers['X-No-Spam'] = 'True'</tt>. Note, while most fields like <tt>To:</tt>
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
45 # <tt>From:</tt> can only appear once in an email header, other fields like <tt>X-Anything</tt>
46 # can appear multiple times. If you want to change a field that can appear multiple times,
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
47 # you need to set it to nil first so that Mail knows you are replacing it and not adding
48 # another field of the same name.
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
49 #
9520166f » mikel
2010-01-27 Fixed up being able to pass random headers in with headers, or mail. …
50 # * <tt>headers(hash)</tt> - Allows you to specify multiple headers in your email such
51 # as <tt>headers({'X-No-Spam' => 'True', 'In-Reply-To' => '1234@message.id'})</tt>
52 #
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
53 # * <tt>mail</tt> - Allows you to specify email to be sent.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
54 #
9520166f » mikel
2010-01-27 Fixed up being able to pass random headers in with headers, or mail. …
55 # The hash passed to the mail method allows you to specify any header that a Mail::Message
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
56 # will accept (any valid Email header including optional fields).
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
57 #
58 # The mail method, if not passed a block, will inspect your views and send all the views with
b62c5493 » jasonfox
2011-06-15 The name for the plain text template in Rails3 appears to be method.t…
59 # the same name as the method, so the above action would send the +welcome.text.erb+ view
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
60 # file as well as the +welcome.text.html.erb+ view file in a +multipart/alternative+ email.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
61 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
62 # If you want to explicitly render only certain templates, pass a block:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
63 #
c1251160 » dchelimsky
2010-06-12 docfix (email instead of emai)
64 # mail(:to => user.email) do |format|
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
65 # format.text
66 # format.html
67 # end
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
68 #
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
69 # The block syntax is also useful in providing information specific to a part:
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
70 #
c1251160 » dchelimsky
2010-06-12 docfix (email instead of emai)
71 # mail(:to => user.email) do |format|
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
72 # format.text(:content_transfer_encoding => "base64")
73 # format.html
74 # end
75 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
76 # Or even to render a special view:
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
77 #
c1251160 » dchelimsky
2010-06-12 docfix (email instead of emai)
78 # mail(:to => user.email) do |format|
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
79 # format.text
80 # format.html { render "some_other_template" }
81 # end
82 #
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
83 # = Mailer views
84 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
85 # Like Action Controller, each mailer class has a corresponding view directory in which each
86 # method of the class looks for a template with its name.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
87 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
88 # To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same
89 # name as the method in your mailer model. For example, in the mailer defined above, the template at
b62c5493 » jasonfox
2011-06-15 The name for the plain text template in Rails3 appears to be method.t…
90 # <tt>app/views/notifier/welcome.text.erb</tt> would be used to generate the email.
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
91 #
92 # Variables defined in the model are accessible as instance variables in the view.
93 #
94 # Emails by default are sent in plain text, so a sample view for our model example might look like this:
95 #
96 # Hi <%= @account.name %>,
97 # Thanks for joining our service! Please check back often.
98 #
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
99 # You can even use Action Pack helpers in these views. For example:
100 #
101 # You got a new note!
80f1d402 » avakhov
2011-09-26 update ActionMailer example using last truncate helper method signature
102 # <%= truncate(@note.body, :length => 25) %>
ee70d1b6 » josevalim
2009-12-25 adv_attr_accessors in ActionMailer are not sent to the views, use the…
103 #
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
104 # If you need to access the subject, from or the recipients in the view, you can do that through message object:
ee70d1b6 » josevalim
2009-12-25 adv_attr_accessors in ActionMailer are not sent to the views, use the…
105 #
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
106 # You got a new note from <%= message.from %>!
80f1d402 » avakhov
2011-09-26 update ActionMailer example using last truncate helper method signature
107 # <%= truncate(@note.body, :length => 25) %>
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
108 #
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
109 #
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
110 # = Generating URLs
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
111 #
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
112 # URLs can be generated in mailer views using <tt>url_for</tt> or named routes. Unlike controllers from
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
113 # Action Pack, the mailer instance doesn't have any context about the incoming request, so you'll need
114 # to provide all of the details needed to generate a URL.
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
115 #
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
116 # When using <tt>url_for</tt> you'll need to provide the <tt>:host</tt>, <tt>:controller</tt>, and <tt>:action</tt>:
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
117 #
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
118 # <%= url_for(:host => "example.com", :controller => "welcome", :action => "greeting") %>
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
119 #
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
120 # When using named routes you only need to supply the <tt>:host</tt>:
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
121 #
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
122 # <%= users_url(:host => "example.com") %>
123 #
3438f6ca » rafaelfranca
2012-01-05 Array.wrap is no longer needed here
124 # You should use the <tt>named_route_url</tt> style (which generates absolute URLs) and avoid using the
125 # <tt>named_route_path</tt> style (which generates relative URLs), since clients reading the mail will
1f4fb6f6 » mjankowski
2011-06-21 elaborate details on why to use _url instead of _path in mailers
126 # have no concept of a current URL from which to determine a relative path.
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
127 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
128 # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt>
ab62aa1c » jeroenvandijk
2010-07-21 Mention that ActionMailer::Base.default_url_options is now deprecated
129 # option as a configuration option in <tt>config/application.rb</tt>:
4809dcc1 » Cody Fauser
2008-04-21 * Remove default_url_options from mailer generator
130 #
131 # config.action_mailer.default_url_options = { :host => "example.com" }
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
132 #
4f433bcd » mjankowski
2011-06-21 clarify why the only_path => false option is needed when default :hos…
133 # When you decide to set a default <tt>:host</tt> for your mailers, then you need to make sure to use the
3438f6ca » rafaelfranca
2012-01-05 Array.wrap is no longer needed here
134 # <tt>:only_path => false</tt> option when using <tt>url_for</tt>. Since the <tt>url_for</tt> view helper
4f433bcd » mjankowski
2011-06-21 clarify why the only_path => false option is needed when default :hos…
135 # will generate relative URLs by default when a <tt>:host</tt> option isn't explicitly provided, passing
136 # <tt>:only_path => false</tt> will ensure that absolute URLs are generated.
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
137 #
138 # = Sending mail
139 #
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
140 # Once a mailer action and template are defined, you can deliver your message or create it and save it
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
141 # for delivery later:
142 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
143 # Notifier.welcome(david).deliver # sends the email
144 # mail = Notifier.welcome(david) # => a Mail::Message object
145 # mail.deliver # sends the email
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
146 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
147 # You never instantiate your mailer class. Rather, you just call the method you defined on the class itself.
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
148 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
149 # = Multipart Emails
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
150 #
3438f6ca » rafaelfranca
2012-01-05 Array.wrap is no longer needed here
151 # Multipart messages can also be used implicitly because Action Mailer will automatically detect and use
152 # multipart templates, where each template is named after the name of the action, followed by the content
f3db04f6 » mjankowski
2011-06-21 grammar (missing "a") and formatting
153 # type. Each such detected template will be added as a separate part to the message.
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
154 #
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
155 # For example, if the following templates exist:
b62c5493 » jasonfox
2011-06-15 The name for the plain text template in Rails3 appears to be method.t…
156 # * signup_notification.text.erb
21187c0f » dhh
2007-02-21 Apply the rest of Chads patch
157 # * signup_notification.text.html.erb
158 # * signup_notification.text.xml.builder
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
159 # * signup_notification.text.yaml.erb
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
160 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
161 # Each would be rendered and added as a separate part to the message, with the corresponding content
162 # type. The content type for the entire message is automatically set to <tt>multipart/alternative</tt>,
163 # which indicates that the email contains multiple different representations of the same email
164 # body. The same instance variables defined in the action are passed to all email templates.
359caef3 » jamis
2005-05-29 A very thorough refactoring, resulting in new mail property setters a…
165 #
46f30f90 » lifo
2008-05-16 Merge documentation changes from docrails.
166 # Implicit template rendering is not performed if any attachments or parts have been added to the email.
167 # This means that you'll have to manually add each part to the email and set the content type of the email
168 # to <tt>multipart/alternative</tt>.
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
169 #
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
170 # = Attachments
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
171 #
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
172 # Sending attachment in emails is easy:
0a407bca » Marcel Molina
2006-05-10 ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, …
173 #
174 # class ApplicationMailer < ActionMailer::Base
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
175 # def welcome(recipient)
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
176 # attachments['free_book.pdf'] = File.read('path/to/file.pdf')
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
177 # mail(:to => recipient, :subject => "New account information")
db045dbb » dhh
2004-11-24 Initial
178 # end
3b0e1d90 » josh
2008-05-14 Prefer string core_ext inflector methods over directly accessing Infl…
179 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
180 #
b62c5493 » jasonfox
2011-06-15 The name for the plain text template in Rails3 appears to be method.t…
181 # Which will (if it had both a <tt>welcome.text.erb</tt> and <tt>welcome.text.html.erb</tt>
ccf9577a » dolzenko
2010-06-11 Fix a bunch of minor spelling mistakes
182 # template in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
183 # the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside,
184 # and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
185 # with the filename +free_book.pdf+.
c927aa0f » dhh
2004-12-16 Updated documentation
186 #
45b1045d » dmathieu
2012-06-20 raise an error if no implicit mailer template could be found
187 # If you need to send attachments with no content, you need to create an empty view for it,
188 # or add an empty body parameter like this:
189 #
190 # class ApplicationMailer < ActionMailer::Base
191 # def welcome(recipient)
192 # attachments['free_book.pdf'] = File.read('path/to/file.pdf')
193 # mail(:to => recipient, :subject => "New account information", :body => "")
194 # end
195 # end
196 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
197 # = Inline Attachments
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
198 #
199 # You can also specify that a file should be displayed inline with other HTML. This is useful
daad4454 » neerajdotname
2010-07-28 itsy bitsy changes to ActionMailer documentation
200 # if you want to display a corporate logo or a photo.
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
201 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
202 # class ApplicationMailer < ActionMailer::Base
203 # def welcome(recipient)
204 # attachments.inline['photo.png'] = File.read('path/to/photo.png')
205 # mail(:to => recipient, :subject => "Here is what we look like")
206 # end
207 # end
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
208 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
209 # And then to reference the image in the view, you create a <tt>welcome.html.erb</tt> file and
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
210 # make a call to +image_tag+ passing in the attachment you want to display and then call
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
211 # +url+ on the attachment to get the relative content id path for the image source:
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
212 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
213 # <h1>Please Don't Cringe</h1>
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
214 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
215 # <%= image_tag attachments['photo.png'].url -%>
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
216 #
f17159b0 » fxn
2010-06-14 edit pass: the names of Rails components have a space, ie, "Active Re…
217 # As we are using Action View's +image_tag+ method, you can pass in any other options you want:
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
218 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
219 # <h1>Please Don't Cringe</h1>
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
220 #
3762362e » mikel
2010-06-07 Updating readme for ActionMailer::Base
221 # <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%>
b451de0d » spastorino
2010-08-14 Deletes trailing whitespaces (over text files only find * -type f -ex…
222 #
cefc136e » mikel
2010-02-22 Adding options to register observers and interceptors through ActionM…
223 # = Observing and Intercepting Mails
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
224 #
5d0d4d8a » smartinez87
2011-05-23 Remove extra white spaces on ActionMailer docs.
225 # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
5acf76d1 » pacoguzman
2011-06-07 Add action_mailer observer and interceptors configuration options
226 # register classes that are called during the mail delivery life cycle.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
227 #
5acf76d1 » pacoguzman
2011-06-07 Add action_mailer observer and interceptors configuration options
228 # An observer class must implement the <tt>:delivered_email(message)</tt> method which will be
cefc136e » mikel
2010-02-22 Adding options to register observers and interceptors through ActionM…
229 # called once for every email sent after the email has been sent.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
230 #
5acf76d1 » pacoguzman
2011-06-07 Add action_mailer observer and interceptors configuration options
231 # An interceptor class must implement the <tt>:delivering_email(message)</tt> method which will be
cefc136e » mikel
2010-02-22 Adding options to register observers and interceptors through ActionM…
232 # called before the email is sent, allowing you to make modifications to the email before it hits
5acf76d1 » pacoguzman
2011-06-07 Add action_mailer observer and interceptors configuration options
233 # the delivery agents. Your class should make any needed modifications directly to the passed
cefc136e » mikel
2010-02-22 Adding options to register observers and interceptors through ActionM…
234 # in Mail::Message instance.
20bd4bd3 » dhh
2006-09-02 Updated docs and otherwise
235 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
236 # = Default Hash
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
237 #
058f7fea » mikel
2010-05-02 Cleaning up Action Mailer spelling with and without the space
238 # Action Mailer provides some intelligent defaults for your emails, these are usually specified in a
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
239 # default method inside the class definition:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
240 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
241 # class Notifier < ActionMailer::Base
242 # default :sender => 'system@example.com'
243 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
244 #
ad8e1ba4 » chuyeow
2010-11-25 Fix missing word in ActionMailer::Base documentation.
245 # You can pass in any header value that a <tt>Mail::Message</tt> accepts. Out of the box,
246 # <tt>ActionMailer::Base</tt> sets the following:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
247 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
248 # * <tt>:mime_version => "1.0"</tt>
249 # * <tt>:charset => "UTF-8",</tt>
250 # * <tt>:content_type => "text/plain",</tt>
251 # * <tt>:parts_order => [ "text/plain", "text/enriched", "text/html" ]</tt>
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
252 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
253 # <tt>parts_order</tt> and <tt>charset</tt> are not actually valid <tt>Mail::Message</tt> header fields,
058f7fea » mikel
2010-05-02 Cleaning up Action Mailer spelling with and without the space
254 # but Action Mailer translates them appropriately and sets the correct values.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
255 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
256 # As you can pass in any header, you need to either quote the header as a string, or pass it in as
b72cd29e » mikel
2011-01-18 Fixing spelling
257 # an underscored symbol, so the following will work:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
258 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
259 # class Notifier < ActionMailer::Base
260 # default 'Content-Transfer-Encoding' => '7bit',
261 # :content_description => 'This is a description'
262 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
263 #
058f7fea » mikel
2010-05-02 Cleaning up Action Mailer spelling with and without the space
264 # Finally, Action Mailer also supports passing <tt>Proc</tt> objects into the default hash, so you
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
265 # can define methods that evaluate as the message is being generated:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
266 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
267 # class Notifier < ActionMailer::Base
268 # default 'X-Special-Header' => Proc.new { my_method }
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
269 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
270 # private
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
271 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
272 # def my_method
273 # 'some complex call'
274 # end
275 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
276 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
277 # Note that the proc is evaluated right at the start of the mail message generation, so if you
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
278 # set something in the defaults using a proc, and then set the same thing inside of your
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
279 # mailer method, it will get over written by the mailer method.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
280 #
4f28c4fc » jsl
2012-03-10 Add ability to define callbacks in ActionMailer using AbstractControl…
281 # = Callbacks
282 #
283 # You can specify callbacks using before_filter and after_filter for configuring your messages.
284 # This may be useful, for example, when you want to add default inline attachments for all
285 # messages sent out by a certain mailer class:
286 #
287 # class Notifier < ActionMailer::Base
288 # before_filter :add_inline_attachment!
289 #
290 # def welcome
291 # mail
292 # end
293 #
294 # private
295 #
296 # def add_inline_attachment!
297 # attachments.inline["footer.jpg"] = File.read('/path/to/filename.jpg')
298 # end
299 # end
300 #
301 # Callbacks in ActionMailer are implemented using AbstractController::Callbacks, so you
302 # can define and configure callbacks in the same manner that you would use callbacks in
303 # classes that inherit from ActionController::Base.
304 #
305 # Note that unless you have a specific reason to do so, you should prefer using before_filter
306 # rather than after_filter in your ActionMailer classes so that headers are parsed properly.
307 #
c927aa0f » dhh
2004-12-16 Updated documentation
308 # = Configuration options
309 #
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
310 # These options are specified on the class level, like
e968acc2 » radar
2010-11-26 Update ActionMailer documentation to not use deprecated template_root…
311 # <tt>ActionMailer::Base.raise_delivery_errors = true</tt>
c927aa0f » dhh
2004-12-16 Updated documentation
312 #
fb30feb4 » mikel
2010-05-02 Adding more docs to ActionMailer
313 # * <tt>default</tt> - You can pass this in at a class level as well as within the class itself as
314 # per the above section.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
315 #
c927aa0f » dhh
2004-12-16 Updated documentation
316 # * <tt>logger</tt> - the logger is used for generating information on the mailing run if available.
317 # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
318 #
64092de2 » fxn
2008-05-02 Improve documentation coverage and markup
319 # * <tt>smtp_settings</tt> - Allows detailed configuration for <tt>:smtp</tt> delivery method:
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
320 # * <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default
321 # "localhost" setting.
dc4eec11 » lifo
2008-05-09 Merge docrails:
322 # * <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
323 # * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
324 # * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
325 # * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
326 # * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the
327 # authentication type here.
5a898e10 » Peter Baker
2010-10-14 Explain actionamailer authentication types
328 # This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
3457db71 » dalibor
2011-03-03 Correct spelling for Base64 in action_mailer
329 # send password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
5a898e10 » Peter Baker
2010-10-14 Explain actionamailer authentication types
330 # information and a cryptographic Message Digest 5 algorithm to hash important information)
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
331 # * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
332 # and starts to use it.
d500ad3f » joshk
2011-05-24 Removed deprecated ActionMailer API and related tests
333 # * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
334 # really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
335 # of an OpenSSL verify constant ('none', 'peer', 'client_once','fail_if_no_peer_cert') or directly the
a1639ad7 » flop
2011-04-19 Undocumented :openssl_verify_mode option for smtp_settings
336 # constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER,...).
c927aa0f » dhh
2004-12-16 Updated documentation
337 #
46f30f90 » lifo
2008-05-16 Merge documentation changes from docrails.
338 # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
339 # * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
b72cd29e » mikel
2011-01-18 Fixing spelling
340 # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@address</tt>
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
341 # added automatically before the message is sent.
dc4eec11 » lifo
2008-05-09 Merge docrails:
342 #
fbe6c3c1 » edavis10
2009-08-07 Adds a :file delivery_method to save email to a file on disk
343 # * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
344 # * <tt>:location</tt> - The directory into which emails will be written. Defaults to the application
345 # <tt>tmp/mails</tt>.
fbe6c3c1 » edavis10
2009-08-07 Adds a :file delivery_method to save email to a file on disk
346 #
dc4eec11 » lifo
2008-05-09 Merge docrails:
347 # * <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
c927aa0f » dhh
2004-12-16 Updated documentation
348 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
349 # * <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default),
350 # <tt>:sendmail</tt>, <tt>:test</tt>, and <tt>:file</tt>. Or you may provide a custom delivery method
a4726d38 » dmathieu
2012-06-20 just specify what's to be done, not what's not to be.
351 # object e.g. MyOwnDeliveryMethodClass. See the Mail gem documentation on the interface you need to
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
352 # implement for a custom delivery agent.
c927aa0f » dhh
2004-12-16 Updated documentation
353 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
354 # * <tt>perform_deliveries</tt> - Determines whether emails are actually sent from Action Mailer when you
5d0d4d8a » smartinez87
2011-05-23 Remove extra white spaces on ActionMailer docs.
355 # call <tt>.deliver</tt> on an mail message or on an Action Mailer method. This is on by default but can
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
356 # be turned off to aid in functional testing.
c927aa0f » dhh
2004-12-16 Updated documentation
357 #
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
358 # * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
359 # <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
af56c806 » dhh
2005-02-24 Updated documentation
360 #
4964d3b0 » josevalim
2009-12-22 Make ActionMailer::Base inherit from AbstractController::Base
361 class Base < AbstractController::Base
dbcf01e6 » mikel
2010-04-08 Removing quoting.rb, upgrade to 2.1.3.6, changing all utf-8 reference…
362 include DeliveryMethods
f30d73ba » José Valim and Mikel Lindsaar
2010-01-24 Add new class delivery method API.
363 abstract!
364
c03c40b4 » josevalim
2009-12-31 Expose a _render_partial hook as thhe _render_template one and make u…
365 include AbstractController::Logger
83f4d86a » dhh
2009-12-20 Rename the RenderingController module to just plain Rendering
366 include AbstractController::Rendering
a9751a70 » josevalim
2009-10-17 Refactor ActionMailer layout and remove legacy one.
367 include AbstractController::Layouts
684c2dc2 » josevalim
2009-10-18 Remove ActionMailer helpers and rely on AbstractController one.
368 include AbstractController::Helpers
48a3985d » josevalim
2010-01-26 Also include translation in ActionMailer.
369 include AbstractController::Translation
08baa343 » dhh
2010-06-02 Extract assets paths and make them available to Action Mailer as well
370 include AbstractController::AssetPaths
4f28c4fc » jsl
2012-03-10 Add ability to define callbacks in ActionMailer using AbstractControl…
371 include AbstractController::Callbacks
359caef3 » jamis
2005-05-29 A very thorough refactoring, resulting in new mail property setters a…
372
7d862359 » lest
2012-01-07 get rid of using instance_variable_names method from AS
373 self.protected_instance_variables = [:@_action_has_layout]
d42bb684 » josevalim
2011-05-06 More updates to ivars list.
374
972efa11 » josevalim
2010-08-29 Deprecate the old mailer API that was not deprecated yet.
375 helper ActionMailer::MailHelper
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
376
c927aa0f » dhh
2004-12-16 Updated documentation
377 private_class_method :new #:nodoc:
db045dbb » dhh
2004-11-24 Initial
378
e5ab4b0d » jeremy
2010-01-31 Convert to class_attribute
379 class_attribute :default_params
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
380 self.default_params = {
381 :mime_version => "1.0",
dbcf01e6 » mikel
2010-04-08 Removing quoting.rb, upgrade to 2.1.3.6, changing all utf-8 reference…
382 :charset => "UTF-8",
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
383 :content_type => "text/plain",
384 :parts_order => [ "text/plain", "text/enriched", "text/html" ]
e5ab4b0d » jeremy
2010-01-31 Convert to class_attribute
385 }.freeze
e1c13186 » José Valim and Mikel Lindsaar
2010-01-25 Added delivers_from.
386
eda17194 » jamis
2005-07-31 ActionMailer::Base.deliver(email) had been accidentally removed, but …
387 class << self
284ca810 » joshk
2011-04-02 remove AM delegating register_observer and register_interceptor to Ma…
388 # Register one or more Observers which will be notified when mail is delivered.
389 def register_observers(*observers)
390 observers.flatten.compact.each { |observer| register_observer(observer) }
391 end
392
393 # Register one or more Interceptors which will be called before mail is sent.
394 def register_interceptors(*interceptors)
395 interceptors.flatten.compact.each { |interceptor| register_interceptor(interceptor) }
396 end
397
398 # Register an Observer which will be notified when mail is delivered.
399 # Either a class or a string can be passed in as the Observer. If a string is passed in
400 # it will be <tt>constantize</tt>d.
401 def register_observer(observer)
cb9e501a » joshk
2011-04-04 AM register_interceptor and register_observer only constantize if the…
402 delivery_observer = (observer.is_a?(String) ? observer.constantize : observer)
284ca810 » joshk
2011-04-02 remove AM delegating register_observer and register_interceptor to Ma…
403 Mail.register_observer(delivery_observer)
404 end
405
a4679839 » vijaydev
2011-06-08 fix typo
406 # Register an Interceptor which will be called before mail is sent.
9a67a117 » siong1987
2011-05-28 minor typo in the rdoc about Interceptor.
407 # Either a class or a string can be passed in as the Interceptor. If a string is passed in
284ca810 » joshk
2011-04-02 remove AM delegating register_observer and register_interceptor to Ma…
408 # it will be <tt>constantize</tt>d.
409 def register_interceptor(interceptor)
cb9e501a » joshk
2011-04-04 AM register_interceptor and register_observer only constantize if the…
410 delivery_interceptor = (interceptor.is_a?(String) ? interceptor.constantize : interceptor)
284ca810 » joshk
2011-04-02 remove AM delegating register_observer and register_interceptor to Ma…
411 Mail.register_interceptor(delivery_interceptor)
412 end
413
bd5ed651 » technoweenie
2007-11-26 Update ActionMailer so it treats ActionView the same way that ActionC…
414 def mailer_name
c17d200e » lest
2012-05-13 mailer can be anonymous
415 @mailer_name ||= anonymous? ? "anonymous" : name.underscore
bd5ed651 » technoweenie
2007-11-26 Update ActionMailer so it treats ActionView the same way that ActionC…
416 end
0750304c » mikel
2010-01-16 Migrated over to Mail doing delivery.
417 attr_writer :mailer_name
418 alias :controller_path :mailer_name
81c416b7 » josevalim
2009-10-28 More refactoring on ActionMailer::Base.
419
e5ab4b0d » jeremy
2010-01-31 Convert to class_attribute
420 def default(value = nil)
421 self.default_params = default_params.merge(value).freeze if value
422 default_params
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
423 end
424
59f1df1b » jamis
2005-10-16 Update/extend ActionMailer documentation (rdoc)
425 # Receives a raw email, parses it into an email object, decodes it,
426 # instantiates a new mailer, and passes the email object to the mailer
98dc5827 » lifo
2008-05-25 Merge docrails.
427 # object's +receive+ method. If you want your mailer to be able to
428 # process incoming messages, you'll need to implement a +receive+
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
429 # method that accepts the raw email string as a parameter:
59f1df1b » jamis
2005-10-16 Update/extend ActionMailer documentation (rdoc)
430 #
431 # class MyMailer < ActionMailer::Base
432 # def receive(mail)
433 # ...
434 # end
435 # end
704daad7 » josevalim
2010-01-15 Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
436 def receive(raw_mail)
731d4392 » jaggederest
2010-04-27 Change event namespace ordering to most-significant first [#4504 stat…
437 ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
704daad7 » josevalim
2010-01-15 Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
438 mail = Mail.new(raw_mail)
439 set_payload_for_mail(payload, mail)
2a6bc126 » josevalim
2010-01-13 Add subscriber to ActionMailer.
440 new.receive(mail)
441 end
eda17194 » jamis
2005-07-31 ActionMailer::Base.deliver(email) had been accidentally removed, but …
442 end
443
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
444 # Wraps an email delivery inside of Active Support Notifications instrumentation. This
de65c82b » rizwanreza
2010-06-15 Changes call backs to callbacks.
445 # method is actually called by the <tt>Mail::Message</tt> object itself through a callback
bb2c7b43 » mikel
2010-01-29 Updating Action Mailer documentation
446 # when you call <tt>:deliver</tt> on the Mail::Message, calling +deliver_mail+ directly
447 # and passing a Mail::Message will do nothing except tell the logger you sent the email.
e4a989e9 » José Valim and Mikel Lindsaar
2010-01-25 Added delivery_handler method to mail and implemented in ActionMailer…
448 def deliver_mail(mail) #:nodoc:
731d4392 » jaggederest
2010-04-27 Change event namespace ordering to most-significant first [#4504 stat…
449 ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload|
c1763975 » sachin87
2012-01-22 some modifications in action_mailer/base.rb
450 set_payload_for_mail(payload, mail)
ace74974 » José Valim and Mikel Lindsaar
2010-01-25 Got AM working with Mail yield on delivery_handler and updated tests
451 yield # Let Mail do the delivery actions
258ca148 » José Valim and Mikel Lindsaar
2010-01-24 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added cal…
452 end
453 end
454
ad8dc5ab » mikel
2011-01-18 Should use standard ruby signature for respond_to
455 def respond_to?(method, include_private = false) #:nodoc:
99f960a3 » José Valim and Mikel Lindsaar
2010-01-24 Handle some TODOs and deprecations.
456 super || action_methods.include?(method.to_s)
457 end
458
0cb154be » bcardarella
2012-06-23 AsyncMailer documention
459 # Will force ActionMailer to push new messages to the Rails.queue
dc7fd821 » bcardarella
2012-06-23 Asynchronous ActionMailer
460 def async=(truth)
461 if truth
462 require 'action_mailer/async'
812d1e88 » bcardarella
2012-06-23 Support for custom queues on the mailer
463 extend ActionMailer::Async
dc7fd821 » bcardarella
2012-06-23 Asynchronous ActionMailer
464 end
465 end
466
99f960a3 » José Valim and Mikel Lindsaar
2010-01-24 Handle some TODOs and deprecations.
467 protected
468
704daad7 » josevalim
2010-01-15 Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
469 def set_payload_for_mail(payload, mail) #:nodoc:
e8c9cac1 » tenderlove
2010-09-29 self is implied, so remove self
470 payload[:mailer] = name
c905fce3 » josevalim
2010-01-15 Add message_id to AM payload and don't send bcc and cc if they were n…
471 payload[:message_id] = mail.message_id
472 payload[:subject] = mail.subject
473 payload[:to] = mail.to
474 payload[:from] = mail.from
475 payload[:bcc] = mail.bcc if mail.bcc.present?
476 payload[:cc] = mail.cc if mail.cc.present?
477 payload[:date] = mail.date
478 payload[:mail] = mail.encoded
704daad7 » josevalim
2010-01-15 Ensure we just send Ruby Stdlib objects in ActionMailer notifications.
479 end
f30d73ba » José Valim and Mikel Lindsaar
2010-01-24 Add new class delivery method API.
480
99f960a3 » José Valim and Mikel Lindsaar
2010-01-24 Handle some TODOs and deprecations.
481 def method_missing(method, *args) #:nodoc:
4d7b2ee5 » tenderlove
2010-09-29 dry up method missing
482 return super unless respond_to?(method)
483 new(method, *args).message
f30d73ba » José Valim and Mikel Lindsaar
2010-01-24 Add new class delivery method API.
484 end
eda17194 » jamis
2005-07-31 ActionMailer::Base.deliver(email) had been accidentally removed, but …
485 end
486
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
487 attr_internal :message
488
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
489 # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
490 # will be initialized according to the named method. If not, the mailer will
491 # remain uninitialized (useful when you only need to invoke the "receive"
492 # method, for instance).
493 def initialize(method_name=nil, *args)
494 super()
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
495 @_message = Mail.new
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
496 process(method_name, *args) if method_name
497 end
498
3fc609ee » josevalim
2010-04-12 Fix ActionMailer test broken in 99d5459
499 def process(*args) #:nodoc:
500 lookup_context.skip_default_locale!
501 super
502 end
503
972efa11 » josevalim
2010-08-29 Deprecate the old mailer API that was not deprecated yet.
504 def mailer_name
505 self.class.mailer_name
506 end
507
8cc41590 » mark-rushakoff
2012-04-27 Use <tt>Foo::Bar</tt> instead of +Foo::Bar+
508 # Allows you to pass random and unusual headers to the new <tt>Mail::Message</tt> object
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
509 # which will add them to itself.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
510 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
511 # headers['X-Special-Domain-Specific-Header'] = "SecretValue"
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
512 #
9520166f » mikel
2010-01-27 Fixed up being able to pass random headers in with headers, or mail. …
513 # You can also pass a hash into headers of header field names and values, which
514 # will then be set on the Mail::Message object:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
515 #
05c4ad9d » José Valim and Mikel Lindsaar
2010-01-26 Tidy up tests and docs.
516 # headers 'X-Special-Domain-Specific-Header' => "SecretValue",
517 # 'In-Reply-To' => incoming.message_id
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
518 #
ff44c335 » mark-rushakoff
2012-04-27 Fix it's -> its
519 # The resulting Mail::Message will have the following in its header:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
520 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
521 # X-Special-Domain-Specific-Header: SecretValue
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
522 def headers(args=nil)
523 if args
9520166f » mikel
2010-01-27 Fixed up being able to pass random headers in with headers, or mail. …
524 @_message.headers(args)
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
525 else
526 @_message
527 end
528 end
c34cfcc2 » mikel
2010-01-20 Created mail method for new API
529
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
530 # Allows you to add attachments to an email, like so:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
531 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
532 # mail.attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
533 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
534 # If you do this, then Mail will take the file name and work out the mime type
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
535 # set the Content-Type, Content-Disposition, Content-Transfer-Encoding and
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
536 # base64 encode the contents of the attachment all for you.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
537 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
538 # You can also specify overrides if you want by passing a hash instead of a string:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
539 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
540 # mail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
541 # :content => File.read('/path/to/filename.jpg')}
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
542 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
543 # If you want to use a different encoding than Base64, you can pass an encoding in,
544 # but then it is up to you to pass in the content pre-encoded, and don't expect
545 # Mail to know how to decode this data:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
546 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
547 # file_content = SpecialEncode(File.read('/path/to/filename.jpg'))
548 # mail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
549 # :encoding => 'SpecialEncoding',
550 # :content => file_content }
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
551 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
552 # You can also search for specific attachments:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
553 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
554 # # By Filename
755af497 » fxn
2010-07-30 edit pass to apply API guideline wrt the use of "# =>" in example code
555 # mail.attachments['filename.jpg'] # => Mail::Part object or nil
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
556 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
557 # # or by index
755af497 » fxn
2010-07-30 edit pass to apply API guideline wrt the use of "# =>" in example code
558 # mail.attachments[0] # => Mail::Part (first attachment)
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
559 #
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
560 def attachments
561 @_message.attachments
562 end
dcb92536 » José Valim and Mikel Lindsaar
2010-01-22 Add basic template rendering to new DSL.
563
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
564 # The main method that creates the message and renders the email templates. There are
565 # two ways to call this method, with a block, or without a block.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
566 #
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
567 # Both methods accept a headers hash. This hash allows you to specify the most used headers
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
568 # in an email message, these are:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
569 #
058f7fea » mikel
2010-05-02 Cleaning up Action Mailer spelling with and without the space
570 # * <tt>:subject</tt> - The subject of the message, if this is omitted, Action Mailer will
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
571 # ask the Rails I18n class for a translated <tt>:subject</tt> in the scope of
66880cfe » Odaeus
2011-10-20 Correct ActionMailer subject i18n lookup scope.
572 # <tt>[mailer_scope, action_name]</tt> or if this is missing, will translate the
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
573 # humanized version of the <tt>action_name</tt>
574 # * <tt>:to</tt> - Who the message is destined for, can be a string of addresses, or an array
575 # of addresses.
0b05acd4 » mikel
2010-01-26 Implementing class level :defaults hash, instead of delivers_from et al
576 # * <tt>:from</tt> - Who the message is from
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
577 # * <tt>:cc</tt> - Who you would like to Carbon-Copy on this email, can be a string of addresses,
578 # or an array of addresses.
579 # * <tt>:bcc</tt> - Who you would like to Blind-Carbon-Copy on this email, can be a string of
580 # addresses, or an array of addresses.
581 # * <tt>:reply_to</tt> - Who to set the Reply-To header of the email to.
582 # * <tt>:date</tt> - The date to say the email was sent on.
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
583 #
584 # You can set default values for any of the above headers (except :date) by using the <tt>default</tt>
0b05acd4 » mikel
2010-01-26 Implementing class level :defaults hash, instead of delivers_from et al
585 # class method:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
586 #
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
587 # class Notifier < ActionMailer::Base
452bb1e4 » jeremy
2010-01-27 Rename 'defaults' class method to 'default' to reflect that it's a de…
588 # self.default :from => 'no-reply@test.lindsaar.net',
589 # :bcc => 'email_logger@test.lindsaar.net',
590 # :reply_to => 'bounces@test.lindsaar.net'
0b05acd4 » mikel
2010-01-26 Implementing class level :defaults hash, instead of delivers_from et al
591 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
592 #
52c56f9f » wincent
2010-06-29 docs: note that mail() accepts arbitrary headers
593 # If you need other headers not listed above, you can either pass them in
594 # as part of the headers hash or use the <tt>headers['name'] = value</tt>
595 # method.
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
596 #
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
597 # When a <tt>:return_path</tt> is specified as header, that value will be used as the 'envelope from'
5d0d4d8a » smartinez87
2011-05-23 Remove extra white spaces on ActionMailer docs.
598 # address for the Mail message. Setting this is useful when you want delivery notifications
599 # sent to a different address than the one in <tt>:from</tt>. Mail will actually use the
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
600 # <tt>:return_path</tt> in preference to the <tt>:sender</tt> in preference to the <tt>:from</tt>
601 # field for the 'envelope from' value.
602 #
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
603 # If you do not pass a block to the +mail+ method, it will find all templates in the
be35a151 » josevalim
2010-02-19 Allow to choose the template path and template name used in implicit …
604 # view paths using by default the mailer name and the method name that it is being
605 # called from, it will then create parts for each of these templates intelligently,
606 # making educated guesses on correct content type and sequence, and return a fully
607 # prepared Mail::Message ready to call <tt>:deliver</tt> on to send.
608 #
609 # For example:
610 #
611 # class Notifier < ActionMailer::Base
612 # default :from => 'no-reply@test.lindsaar.net',
613 #
614 # def welcome
615 # mail(:to => 'mikel@test.lindsaar.net')
616 # end
617 # end
618 #
45b1045d » dmathieu
2012-06-20 raise an error if no implicit mailer template could be found
619 # Will look for all templates at "app/views/notifier" with name "welcome".
620 # If no welcome template exists, it will raise an ActionView::MissingTemplate error.
621 #
622 # However, those can be customized:
be35a151 » josevalim
2010-02-19 Allow to choose the template path and template name used in implicit …
623 #
624 # mail(:template_path => 'notifications', :template_name => 'another')
625 #
626 # And now it will look for all templates at "app/views/notifications" with name "another".
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
627 #
628 # If you do pass a block, you can render specific templates of your choice:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
629 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
630 # mail(:to => 'mikel@test.lindsaar.net') do |format|
631 # format.text
632 # format.html
633 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
634 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
635 # You can even render text directly without using a template:
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
636 #
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
637 # mail(:to => 'mikel@test.lindsaar.net') do |format|
638 # format.text { render :text => "Hello Mikel!" }
639 # format.html { render :text => "<h1>Hello Mikel!</h1>" }
640 # end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
641 #
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
642 # Which will render a <tt>multipart/alternative</tt> email with <tt>text/plain</tt> and
4a6eba32 » José Valim and Mikel Lindsaar
2010-01-25 Added initial documentation for the new API
643 # <tt>text/html</tt> parts.
65899765 » José Valim and Mikel Lindsaar
2010-01-26 Remove old files, add some information to docs and improve test suite.
644 #
645 # The block syntax also allows you to customize the part headers if desired:
646 #
647 # mail(:to => 'mikel@test.lindsaar.net') do |format|
648 # format.text(:content_transfer_encoding => "base64")
649 # format.html
650 # end
651 #
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
652 def mail(headers={}, &block)
653 m = @_message
258ca148 » José Valim and Mikel Lindsaar
2010-01-24 Delegated ActionMailer::Base.deliveries to Mail.deliveries, added cal…
654
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
655 # At the beginning, do not consider class default for parts order neither content_type
656 content_type = headers[:content_type]
657 parts_order = headers[:parts_order]
1cd55928 » José Valim and Mikel Lindsaar
2010-01-22 First work on implicit multipart.
658
08b07b60 » mikel
2010-05-02 Adding ability to pass proc's to the ActionMailer class default method
659 # Call all the procs (if any)
c1763975 » sachin87
2012-01-22 some modifications in action_mailer/base.rb
660 class_default = self.class.default
661 default_values = class_default.merge(class_default) do |k,v|
3fbc042b » lest
2012-01-23 Use instance_eval instead of Proc#bind
662 v.respond_to?(:to_proc) ? instance_eval(&v) : v
08b07b60 » mikel
2010-05-02 Adding ability to pass proc's to the ActionMailer class default method
663 end
458f5712 » wycats
2010-05-15 Remove the need for a special action_mailer.url_for initializer that …
664
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
665 # Handle defaults
08b07b60 » mikel
2010-05-02 Adding ability to pass proc's to the ActionMailer class default method
666 headers = headers.reverse_merge(default_values)
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
667 headers[:subject] ||= default_i18n_subject
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
668
669 # Apply charset at the beginning so all fields are properly quoted
670 m.charset = charset = headers[:charset]
671
672 # Set configure delivery behavior
673 wrap_delivery_behavior!(headers.delete(:delivery_method))
674
675 # Assign all headers except parts_order, content_type and body
b4fd5e6f » josevalim
2010-04-13 template_name and template_path should not be added to mail headers.
676 assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path)
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
677 assignable.each { |k, v| m[k] = v }
951397b4 » José Valim and Mikel Lindsaar
2010-01-22 Get implicit multipart and attachments working together.
678
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
679 # Render the templates and blocks
39a1b06f » José Valim and Mikel Lindsaar
2010-01-26 Deprecate old defaults API.
680 responses, explicit_order = collect_responses_and_parts_order(headers, &block)
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
681 create_parts_from_responses(m, responses)
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
682
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
683 # Setup content type, reapply charset and handle parts order
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
684 m.content_type = set_content_type(m, content_type, headers[:content_type])
951397b4 » José Valim and Mikel Lindsaar
2010-01-22 Get implicit multipart and attachments working together.
685 m.charset = charset
686
e7e4ed48 » José Valim and Mikel Lindsaar
2010-01-24 Set sort order for explicit parts from the collector's template sequence
687 if m.multipart?
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
688 parts_order ||= explicit_order || headers[:parts_order]
689 m.body.set_sort_order(parts_order)
951397b4 » José Valim and Mikel Lindsaar
2010-01-22 Get implicit multipart and attachments working together.
690 m.body.sort_parts!
691 end
bb9d71ff » José Valim and Mikel Lindsaar
2010-01-22 Move class methods to deprecated stuff.
692
c34cfcc2 » mikel
2010-01-20 Created mail method for new API
693 m
694 end
695
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
696 protected
697
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
698 def set_content_type(m, user_content_type, class_default)
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
699 params = m.content_type_parameters || {}
700 case
701 when user_content_type.present?
702 user_content_type
703 when m.has_attachments?
311d99ee » mikel
2010-06-07 Adding inline attachment support to ActionMailer
704 if m.attachments.detect { |a| a.inline? }
705 ["multipart", "related", params]
706 else
707 ["multipart", "mixed", params]
708 end
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
709 when m.multipart?
710 ["multipart", "alternative", params]
711 else
b6b3db67 » mikel
2010-01-28 Fixed bug on HTML only emails getting set to text/plain
712 m.content_type || class_default
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
713 end
714 end
715
11b67b38 » indrekj
2011-12-20 fix default_i18n_subject comment in ActionMailer::Base
716 # Translates the +subject+ using Rails I18n class under <tt>[mailer_scope, action_name]</tt> scope.
082e299e » smartinez87
2011-04-18 docs for ActionMailer::Base.default_i18n_subject
717 # If it does not find a translation for the +subject+ under the specified scope it will default to a
718 # humanized version of the <tt>action_name</tt>.
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
719 def default_i18n_subject #:nodoc:
2d8396fc » jurriaan
2012-04-03 Updated/changed useless tr/gsubs
720 mailer_scope = self.class.mailer_name.tr('/', '.')
30eaecb3 » josevalim
2010-06-12 subject is automatically looked up on I18n using mailer_name and acti…
721 I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
5c3ef8c1 » José Valim and Mikel Lindsaar
2010-01-23 Refactor subject with i18n.
722 end
723
39a1b06f » José Valim and Mikel Lindsaar
2010-01-26 Deprecate old defaults API.
724 def collect_responses_and_parts_order(headers) #:nodoc:
725 responses, parts_order = [], nil
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
726
727 if block_given?
a09e9925 » josevalim
2010-03-27 Ensure details are frozen after @details_keys lookup. The implementat…
728 collector = ActionMailer::Collector.new(lookup_context) { render(action_name) }
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
729 yield(collector)
39a1b06f » José Valim and Mikel Lindsaar
2010-01-26 Deprecate old defaults API.
730 parts_order = collector.responses.map { |r| r[:content_type] }
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
731 responses = collector.responses
732 elsif headers[:body]
733 responses << {
be35a151 » josevalim
2010-02-19 Allow to choose the template path and template name used in implicit …
734 :body => headers.delete(:body),
452bb1e4 » jeremy
2010-01-27 Rename 'defaults' class method to 'default' to reflect that it's a de…
735 :content_type => self.class.default[:content_type] || "text/plain"
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
736 }
737 else
be35a151 » josevalim
2010-02-19 Allow to choose the template path and template name used in implicit …
738 templates_path = headers.delete(:template_path) || self.class.mailer_name
739 templates_name = headers.delete(:template_name) || action_name
740
741 each_template(templates_path, templates_name) do |template|
f28d856c » josevalim
2010-03-19 Improve performance of the rendering stack by freezing formats as a s…
742 self.formats = template.formats
743
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
744 responses << {
2a126868 » josevalim
2010-03-12 Allow anything that responds to render to be given as :template and u…
745 :body => render(:template => template),
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
746 :content_type => template.mime_type.to_s
747 }
748 end
749 end
750
39a1b06f » José Valim and Mikel Lindsaar
2010-01-26 Deprecate old defaults API.
751 [responses, parts_order]
7409b734 » José Valim and Mikel Lindsaar
2010-01-24 Some refactoring.
752 end
753
be35a151 » josevalim
2010-02-19 Allow to choose the template path and template name used in implicit …
754 def each_template(paths, name, &block) #:nodoc:
3438f6ca » rafaelfranca
2012-01-05 Array.wrap is no longer needed here
755 templates = lookup_context.find_all(name, Array(paths))
45b1045d » dmathieu
2012-06-20 raise an error if no implicit mailer template could be found
756 if templates.empty?
757 raise ActionView::MissingTemplate.new([paths], name, [paths], false, 'mailer')
758 else
759 templates.uniq { |t| t.formats }.each(&block)
760 end
99f960a3 » José Valim and Mikel Lindsaar
2010-01-24 Handle some TODOs and deprecations.
761 end
762
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
763 def create_parts_from_responses(m, responses) #:nodoc:
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
764 if responses.size == 1 && !m.has_attachments?
9dd65c36 » José Valim and Mikel Lindsaar
2010-01-26 Make defaults accept a hash.
765 responses[0].each { |k,v| m[k] = v }
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
766 elsif responses.size > 1 && m.has_attachments?
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
767 container = Mail::Part.new
74a5889a » José Valim and Mikel Lindsaar
2010-01-26 Refactor content type setting, added tests to ensure boundary exists …
768 container.content_type = "multipart/alternative"
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
769 responses.each { |r| insert_part(container, r, m.charset) }
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
770 m.add_part(container)
771 else
b5f9a9fc » josevalim
2010-04-12 Move set_fields! to the old API module.
772 responses.each { |r| insert_part(m, r, m.charset) }
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
773 end
359caef3 » jamis
2005-05-29 A very thorough refactoring, resulting in new mail property setters a…
774 end
775
6ba94460 » José Valim and Mikel Lindsaar
2010-01-23 Make implicit and explicit templates pass through the same part creat…
776 def insert_part(container, response, charset) #:nodoc:
777 response[:charset] ||= charset
778 part = Mail::Part.new(response)
779 container.add_part(part)
359caef3 » jamis
2005-05-29 A very thorough refactoring, resulting in new mail property setters a…
780 end
3fad0cd0 » dhh
2005-02-19 Added support for charsets for both subject and body. The default cha…
781
ef5dadaf » nex3
2010-04-27 Only run load hooks once a file has been fully loaded.
782 ActiveSupport.run_load_hooks(:action_mailer, self)
db045dbb » dhh
2004-11-24 Initial
783 end
784 end
d0c4fd75 » judearasu
2011-06-19 typo changes
785
Something went wrong with that request. Please try again.