actionmailer 7.0.4 → 7.1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89846ce54fa64fd2bb0f22df01bb715cda570228c93f07509f4a909064ed75ec
4
- data.tar.gz: 7fdf70931606ba75ba7995e7fffdab0f8dd251f8a95115a6da637d575a1b6151
3
+ metadata.gz: 65ca25381119a735258d9cbda82ec18416f4043fa4341a551ef381046bbc5f9a
4
+ data.tar.gz: 056e9bd91385999a64786d99b2eabc9a2352dbf0f393b8b1cd8e2bb40d1d9178
5
5
  SHA512:
6
- metadata.gz: 800506239e9f8aaca4e1349427b99de82259f6702ab9c03d3eb4e7d8e9afe3f20f7bdaad05ec137d6121a5d1d4bdc7257a7f348ebf1f5f17fb7252372946256c
7
- data.tar.gz: 9281ce7def6b0d9a5968b7e1fb695285225f836cf564fd43ed420ee1031fba4dd667363b6908be969c468bfea85e321b48f6b3993777145a63a7615370d76210
6
+ metadata.gz: b9d722ac033c8727a8cb776bd886eb350f1e8cbe8627e784a1d60cbbd8147cefcbdd00ec74b7f80b12482361c55cac13248fcd6b48ecf2b1b29a722a1bb73c01
7
+ data.tar.gz: 86ae2eb8489c31c1428c0698715ab7819f8974c96ea16fb28d04156e78fc1cccfb79c8482ece17a4a2828c0f5f083f6b67c026b7bc809351dbf3cb6d6a31abb3
data/CHANGELOG.md CHANGED
@@ -1,86 +1,209 @@
1
- ## Rails 7.0.4 (September 09, 2022) ##
1
+ ## Rails 7.1.5.1 (December 10, 2024) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 7.0.3.1 (July 12, 2022) ##
6
+ ## Rails 7.1.5 (October 30, 2024) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 7.0.3 (May 09, 2022) ##
11
+ ## Rails 7.1.4.2 (October 23, 2024) ##
12
12
 
13
- * No changes.
13
+ * Fix NoMethodError in `block_format` helper
14
+
15
+ *Michael Leimstaedtner*
16
+
17
+
18
+ ## Rails 7.1.4.1 (October 15, 2024) ##
19
+
20
+ * Avoid regex backtracking in `block_format` helper
21
+
22
+ [CVE-2024-47889]
14
23
 
24
+ *John Hawthorn*
15
25
 
16
- ## Rails 7.0.2.4 (April 26, 2022) ##
26
+
27
+ ## Rails 7.1.4 (August 22, 2024) ##
17
28
 
18
29
  * No changes.
19
30
 
20
31
 
21
- ## Rails 7.0.2.3 (March 08, 2022) ##
32
+ ## Rails 7.1.3.4 (June 04, 2024) ##
22
33
 
23
34
  * No changes.
24
35
 
25
36
 
26
- ## Rails 7.0.2.2 (February 11, 2022) ##
37
+ ## Rails 7.1.3.3 (May 16, 2024) ##
27
38
 
28
39
  * No changes.
29
40
 
30
41
 
31
- ## Rails 7.0.2.1 (February 11, 2022) ##
42
+ ## Rails 7.1.3.2 (February 21, 2024) ##
32
43
 
33
44
  * No changes.
34
45
 
35
46
 
36
- ## Rails 7.0.2 (February 08, 2022) ##
47
+ ## Rails 7.1.3.1 (February 21, 2024) ##
37
48
 
38
49
  * No changes.
39
50
 
40
51
 
41
- ## Rails 7.0.1 (January 06, 2022) ##
52
+ ## Rails 7.1.3 (January 16, 2024) ##
53
+
54
+ * No changes.
42
55
 
43
- * Keep configuration of `smtp_settings` consistent between 6.1 and 7.0.
44
56
 
45
- *André Luis Leal Cardoso Junior*
57
+ ## Rails 7.1.2 (November 10, 2023) ##
58
+
59
+ * No changes.
46
60
 
47
61
 
48
- ## Rails 7.0.0 (December 15, 2021) ##
62
+ ## Rails 7.1.1 (October 11, 2023) ##
49
63
 
50
64
  * No changes.
51
65
 
52
66
 
53
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
67
+ ## Rails 7.1.0 (October 05, 2023) ##
54
68
 
55
69
  * No changes.
56
70
 
57
71
 
58
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
72
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
59
73
 
60
74
  * No changes.
61
75
 
62
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
63
76
 
64
- * Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
65
- in favor of `ActionMailer::MailDeliveryJob`.
77
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
66
78
 
67
- *Rafael Mendonça França*
79
+ * Introduce `ActionMailer::FormBuilder`
68
80
 
69
- * `email_address_with_name` returns just the address if name is blank.
81
+ Use the `default_form_builder` method in mailers to set the default form builder
82
+ for templates rendered by that mailer. Matches the behaviour in Action Controller.
70
83
 
71
- *Thomas Hutterer*
84
+ *Alex Ghiculescu*
72
85
 
73
86
 
74
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
87
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
75
88
 
76
- * No changes.
89
+ * Mailers are listed in alphabetical order on the mailer preview page now.
90
+
91
+ *Martin Spickermann*
92
+
93
+ * Deprecate passing params to `assert_enqueued_email_with` via the `:args`
94
+ kwarg. `assert_enqueued_email_with` now supports a `:params` kwarg, so use
95
+ that to pass params:
96
+
97
+ ```ruby
98
+ # BEFORE
99
+ assert_enqueued_email_with MyMailer, :my_method, args: { my_param: "value" }
100
+
101
+ # AFTER
102
+ assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" }
103
+ ```
104
+
105
+ To specify named mailer args as a Hash, wrap the Hash in an array:
106
+
107
+ ```ruby
108
+ assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }]
109
+ # OR
110
+ assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"]
111
+ ```
112
+
113
+ *Jonathan Hefner*
114
+
115
+ * Accept procs for args and params in `assert_enqueued_email_with`
116
+
117
+ ```ruby
118
+ assert_enqueued_email_with DeliveryJob, params: -> p { p[:token] =~ /\w+/ } do
119
+ UserMailer.with(token: user.generate_token).email_verification.deliver_later
120
+ end
121
+ ```
122
+
123
+ *Max Chernyak*
124
+
125
+ * Added `*_deliver` callbacks to `ActionMailer::Base` that wrap mail message delivery.
126
+
127
+ Example:
128
+
129
+ ```ruby
130
+ class EventsMailer < ApplicationMailer
131
+ after_deliver do
132
+ User.find_by(email: message.to.first).update(email_provider_id: message.message_id, emailed_at: Time.current)
133
+ end
134
+ end
135
+ ```
136
+
137
+ *Ben Sheldon*
138
+
139
+ * Added `deliver_enqueued_emails` to `ActionMailer::TestHelper`. This method
140
+ delivers all enqueued email jobs.
141
+
142
+ Example:
143
+
144
+ ```ruby
145
+ def test_deliver_enqueued_emails
146
+ deliver_enqueued_emails do
147
+ ContactMailer.welcome.deliver_later
148
+ end
149
+ assert_emails 1
150
+ end
151
+ ```
152
+
153
+ *Andrew Novoselac*
154
+
155
+ * The `deliver_later_queue_name` used by the default mailer job can now be
156
+ configured on a per-mailer basis. Previously this was only configurable
157
+ for all mailers via `ActionMailer::Base`.
158
+
159
+ Example:
160
+
161
+ ```ruby
162
+ class EventsMailer < ApplicationMailer
163
+ self.deliver_later_queue_name = :throttled_mailer
164
+ end
165
+ ```
166
+
167
+ *Jeffrey Hardy*
168
+
169
+ * Email previews now include an expandable section to show all headers.
170
+
171
+ Headers like `Message-ID` for threading or email service provider specific
172
+ features like analytics tags or account metadata can now be viewed directly
173
+ in the mailer preview.
174
+
175
+ *Matt Swanson*
176
+
177
+ * Default `ActionMailer::Parameterized#params` to an empty `Hash`
178
+
179
+ *Sean Doyle*
180
+
181
+ * Introduce the `capture_emails` test helper.
182
+
183
+ Returns all emails that are sent in a block.
184
+
185
+ ```ruby
186
+ def test_emails
187
+ emails = capture_emails do
188
+ ContactMailer.welcome.deliver_now
189
+ ContactMailer.welcome.deliver_later
190
+ end
191
+ assert_email "Hi there", emails.first.subject
192
+ end
193
+ ```
194
+
195
+ *Alex Ghiculescu*
77
196
 
197
+ * Added ability to download `.eml` file for the email preview.
78
198
 
79
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
199
+ *Igor Kasyanchuk*
80
200
 
81
- * Configures a default of 5 for both `open_timeout` and `read_timeout` for SMTP Settings.
201
+ * Support multiple preview paths for mailers.
82
202
 
83
- *André Luis Leal Cardoso Junior*
203
+ Option `config.action_mailer.preview_path` is deprecated in favor of
204
+ `config.action_mailer.preview_paths`. Appending paths to this configuration option
205
+ will cause those paths to be used in the search for mailer previews.
84
206
 
207
+ *fatkodima*
85
208
 
86
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailer/CHANGELOG.md) for previous changes.
209
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionmailer/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2022 David Heinemeier Hansson
1
+ Copyright (c) David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ Additionally, an Action Mailer class can be used to process incoming email,
13
13
  such as allowing a blog to accept new posts from an email (which could even
14
14
  have been sent from a phone).
15
15
 
16
- You can read more about Action Mailer in the {Action Mailer Basics}[https://edgeguides.rubyonrails.org/action_mailer_basics.html] guide.
16
+ You can read more about Action Mailer in the {Action Mailer Basics}[https://guides.rubyonrails.org/action_mailer_basics.html] guide.
17
17
 
18
18
  == Sending emails
19
19
 
@@ -78,7 +78,7 @@ Or you can just chain the methods together like:
78
78
 
79
79
  It is possible to set default values that will be used in every method in your
80
80
  Action Mailer class. To implement this functionality, you just call the public
81
- class method +default+ which you get for free from <tt>ActionMailer::Base</tt>.
81
+ class method +default+ which you get for free from ActionMailer::Base.
82
82
  This method accepts a Hash as the parameter. You can use any of the headers,
83
83
  email messages have, like +:from+ as the key. You can also pass in a string as
84
84
  the key, like "Content-Type", but Action Mailer does this out of the box for you,
@@ -114,7 +114,7 @@ The latest version of Action Mailer can be installed with RubyGems:
114
114
 
115
115
  $ gem install actionmailer
116
116
 
117
- Source code can be downloaded as part of the Rails project on GitHub:
117
+ Source code can be downloaded as part of the \Rails project on GitHub:
118
118
 
119
119
  * https://github.com/rails/rails/tree/main/actionmailer
120
120
 
@@ -132,7 +132,7 @@ API documentation is at
132
132
 
133
133
  * https://api.rubyonrails.org
134
134
 
135
- Bug reports for the Ruby on Rails project can be filed here:
135
+ Bug reports for the Ruby on \Rails project can be filed here:
136
136
 
137
137
  * https://github.com/rails/rails/issues
138
138
 
@@ -10,16 +10,18 @@ require "action_mailer/log_subscriber"
10
10
  require "action_mailer/rescuable"
11
11
 
12
12
  module ActionMailer
13
+ # = Action Mailer \Base
14
+ #
13
15
  # Action Mailer allows you to send email from your application using a mailer model and views.
14
16
  #
15
- # = Mailer Models
17
+ # == Mailer Models
16
18
  #
17
19
  # To use Action Mailer, you need to create a mailer model.
18
20
  #
19
21
  # $ bin/rails generate mailer Notifier
20
22
  #
21
23
  # The generated model inherits from <tt>ApplicationMailer</tt> which in turn
22
- # inherits from <tt>ActionMailer::Base</tt>. A mailer model defines methods
24
+ # inherits from +ActionMailer::Base+. A mailer model defines methods
23
25
  # used to generate an email message. In these methods, you can set up variables to be used in
24
26
  # the mailer views, options on the mail itself such as the <tt>:from</tt> address, and attachments.
25
27
  #
@@ -56,7 +58,7 @@ module ActionMailer
56
58
  #
57
59
  # * <tt>mail</tt> - Allows you to specify email to be sent.
58
60
  #
59
- # The hash passed to the mail method allows you to specify any header that a <tt>Mail::Message</tt>
61
+ # The hash passed to the mail method allows you to specify any header that a +Mail::Message+
60
62
  # will accept (any valid email header including optional fields).
61
63
  #
62
64
  # The +mail+ method, if not passed a block, will inspect your views and send all the views with
@@ -84,7 +86,7 @@ module ActionMailer
84
86
  # format.html { render "some_other_template" }
85
87
  # end
86
88
  #
87
- # = Mailer views
89
+ # == Mailer views
88
90
  #
89
91
  # Like Action Controller, each mailer class has a corresponding view directory in which each
90
92
  # method of the class looks for a template with its name.
@@ -112,7 +114,7 @@ module ActionMailer
112
114
  # <%= truncate(@note.body, length: 25) %>
113
115
  #
114
116
  #
115
- # = Generating URLs
117
+ # == Generating URLs
116
118
  #
117
119
  # URLs can be generated in mailer views using <tt>url_for</tt> or named routes. Unlike controllers from
118
120
  # Action Pack, the mailer instance doesn't have any context about the incoming request, so you'll need
@@ -140,7 +142,7 @@ module ActionMailer
140
142
  #
141
143
  # By default when <tt>config.force_ssl</tt> is +true+, URLs generated for hosts will use the HTTPS protocol.
142
144
  #
143
- # = Sending mail
145
+ # == Sending mail
144
146
  #
145
147
  # Once a mailer action and template are defined, you can deliver your message or defer its creation and
146
148
  # delivery for later:
@@ -150,7 +152,7 @@ module ActionMailer
150
152
  # mail.deliver_now # generates and sends the email now
151
153
  #
152
154
  # The ActionMailer::MessageDelivery class is a wrapper around a delegate that will call
153
- # your method to generate the mail. If you want direct access to the delegator, or <tt>Mail::Message</tt>,
155
+ # your method to generate the mail. If you want direct access to the delegator, or +Mail::Message+,
154
156
  # you can call the <tt>message</tt> method on the ActionMailer::MessageDelivery object.
155
157
  #
156
158
  # NotifierMailer.welcome(User.first).message # => a Mail::Message object
@@ -165,7 +167,7 @@ module ActionMailer
165
167
  # You never instantiate your mailer class. Rather, you just call the method you defined on the class itself.
166
168
  # All instance methods are expected to return a message object to be sent.
167
169
  #
168
- # = Multipart Emails
170
+ # == Multipart Emails
169
171
  #
170
172
  # Multipart messages can also be used implicitly because Action Mailer will automatically detect and use
171
173
  # multipart templates, where each template is named after the name of the action, followed by the content
@@ -186,7 +188,7 @@ module ActionMailer
186
188
  # This means that you'll have to manually add each part to the email and set the content type of the email
187
189
  # to <tt>multipart/alternative</tt>.
188
190
  #
189
- # = Attachments
191
+ # == Attachments
190
192
  #
191
193
  # Sending attachment in emails is easy:
192
194
  #
@@ -213,7 +215,7 @@ module ActionMailer
213
215
  # end
214
216
  # end
215
217
  #
216
- # You can also send attachments with html template, in this case you need to add body, attachments,
218
+ # You can also send attachments with HTML template, in this case you need to add body, attachments,
217
219
  # and custom content type like this:
218
220
  #
219
221
  # class NotifierMailer < ApplicationMailer
@@ -226,7 +228,7 @@ module ActionMailer
226
228
  # end
227
229
  # end
228
230
  #
229
- # = Inline Attachments
231
+ # == Inline Attachments
230
232
  #
231
233
  # You can also specify that a file should be displayed inline with other HTML. This is useful
232
234
  # if you want to display a corporate logo or a photo.
@@ -252,7 +254,7 @@ module ActionMailer
252
254
  #
253
255
  # <%= image_tag attachments['photo.png'].url, alt: 'Our Photo', class: 'photo' -%>
254
256
  #
255
- # = Observing and Intercepting Mails
257
+ # == Observing and Intercepting Mails
256
258
  #
257
259
  # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
258
260
  # register classes that are called during the mail delivery life cycle.
@@ -263,9 +265,9 @@ module ActionMailer
263
265
  # An interceptor class must implement the <tt>:delivering_email(message)</tt> method which will be
264
266
  # called before the email is sent, allowing you to make modifications to the email before it hits
265
267
  # the delivery agents. Your class should make any needed modifications directly to the passed
266
- # in <tt>Mail::Message</tt> instance.
268
+ # in +Mail::Message+ instance.
267
269
  #
268
- # = Default Hash
270
+ # == Default \Hash
269
271
  #
270
272
  # Action Mailer provides some intelligent defaults for your emails, these are usually specified in a
271
273
  # default method inside the class definition:
@@ -274,15 +276,15 @@ module ActionMailer
274
276
  # default sender: 'system@example.com'
275
277
  # end
276
278
  #
277
- # You can pass in any header value that a <tt>Mail::Message</tt> accepts. Out of the box,
278
- # <tt>ActionMailer::Base</tt> sets the following:
279
+ # You can pass in any header value that a +Mail::Message+ accepts. Out of the box,
280
+ # +ActionMailer::Base+ sets the following:
279
281
  #
280
282
  # * <tt>mime_version: "1.0"</tt>
281
283
  # * <tt>charset: "UTF-8"</tt>
282
284
  # * <tt>content_type: "text/plain"</tt>
283
285
  # * <tt>parts_order: [ "text/plain", "text/enriched", "text/html" ]</tt>
284
286
  #
285
- # <tt>parts_order</tt> and <tt>charset</tt> are not actually valid <tt>Mail::Message</tt> header fields,
287
+ # <tt>parts_order</tt> and <tt>charset</tt> are not actually valid +Mail::Message+ header fields,
286
288
  # but Action Mailer translates them appropriately and sets the correct values.
287
289
  #
288
290
  # As you can pass in any header, you need to either quote the header as a string, or pass it in as
@@ -314,14 +316,16 @@ module ActionMailer
314
316
  #
315
317
  # config.action_mailer.default_options = { from: "no-reply@example.org" }
316
318
  #
317
- # = Callbacks
319
+ # == \Callbacks
318
320
  #
319
- # You can specify callbacks using <tt>before_action</tt> and <tt>after_action</tt> for configuring your messages.
320
- # This may be useful, for example, when you want to add default inline attachments for all
321
- # messages sent out by a certain mailer class:
321
+ # You can specify callbacks using <tt>before_action</tt> and <tt>after_action</tt> for configuring your messages,
322
+ # and using <tt>before_deliver</tt> and <tt>after_deliver</tt> for wrapping the delivery process.
323
+ # For example, when you want to add default inline attachments and log delivery for all messages
324
+ # sent out by a certain mailer class:
322
325
  #
323
326
  # class NotifierMailer < ApplicationMailer
324
327
  # before_action :add_inline_attachment!
328
+ # after_deliver :log_delivery
325
329
  #
326
330
  # def welcome
327
331
  # mail
@@ -331,9 +335,13 @@ module ActionMailer
331
335
  # def add_inline_attachment!
332
336
  # attachments.inline["footer.jpg"] = File.read('/path/to/filename.jpg')
333
337
  # end
338
+ #
339
+ # def log_delivery
340
+ # Rails.logger.info "Sent email with message id '#{message.message_id}' at #{Time.current}."
341
+ # end
334
342
  # end
335
343
  #
336
- # Callbacks in Action Mailer are implemented using
344
+ # Action callbacks in Action Mailer are implemented using
337
345
  # AbstractController::Callbacks, so you can define and configure
338
346
  # callbacks in the same manner that you would use callbacks in classes that
339
347
  # inherit from ActionController::Base.
@@ -342,7 +350,7 @@ module ActionMailer
342
350
  # using <tt>before_action</tt> rather than <tt>after_action</tt> in your
343
351
  # Action Mailer classes so that headers are parsed properly.
344
352
  #
345
- # = Rescuing Errors
353
+ # == Rescuing Errors
346
354
  #
347
355
  # +rescue+ blocks inside of a mailer method cannot rescue errors that occur
348
356
  # outside of rendering -- for example, record deserialization errors in a
@@ -365,10 +373,10 @@ module ActionMailer
365
373
  # end
366
374
  # end
367
375
  #
368
- # = Previewing emails
376
+ # == Previewing emails
369
377
  #
370
378
  # You can preview your email templates visually by adding a mailer preview file to the
371
- # <tt>ActionMailer::Base.preview_path</tt>. Since most emails do something interesting
379
+ # <tt>ActionMailer::Base.preview_paths</tt>. Since most emails do something interesting
372
380
  # with database data, you'll need to write some scenarios to load messages with fake data:
373
381
  #
374
382
  # class NotifierMailerPreview < ActionMailer::Preview
@@ -377,12 +385,12 @@ module ActionMailer
377
385
  # end
378
386
  # end
379
387
  #
380
- # Methods must return a <tt>Mail::Message</tt> object which can be generated by calling the mailer
388
+ # Methods must return a +Mail::Message+ object which can be generated by calling the mailer
381
389
  # method without the additional <tt>deliver_now</tt> / <tt>deliver_later</tt>. The location of the
382
- # mailer previews directory can be configured using the <tt>preview_path</tt> option which has a default
390
+ # mailer preview directories can be configured using the <tt>preview_paths</tt> option which has a default
383
391
  # of <tt>test/mailers/previews</tt>:
384
392
  #
385
- # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
393
+ # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
386
394
  #
387
395
  # An overview of all previews is accessible at <tt>http://localhost:3000/rails/mailers</tt>
388
396
  # on a running development server instance.
@@ -402,7 +410,7 @@ module ActionMailer
402
410
  # and <tt>register_preview_interceptor</tt> if they should operate on both sending and
403
411
  # previewing emails.
404
412
  #
405
- # = Configuration options
413
+ # == Configuration options
406
414
  #
407
415
  # These options are specified on the class level, like
408
416
  # <tt>ActionMailer::Base.raise_delivery_errors = true</tt>
@@ -425,20 +433,21 @@ module ActionMailer
425
433
  # This is a symbol and one of <tt>:plain</tt> (will send the password Base64 encoded), <tt>:login</tt> (will
426
434
  # send the password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
427
435
  # information and a cryptographic Message Digest 5 algorithm to hash important information)
428
- # * <tt>:enable_starttls</tt> - Use STARTTLS when connecting to your SMTP server and fail if unsupported. Defaults to <tt>false</tt>.
436
+ # * <tt>:enable_starttls</tt> - Use STARTTLS when connecting to your SMTP server and fail if unsupported. Defaults
437
+ # to <tt>false</tt>. Requires at least version 2.7 of the Mail gem.
429
438
  # * <tt>:enable_starttls_auto</tt> - Detects if STARTTLS is enabled in your SMTP server and starts
430
439
  # to use it. Defaults to <tt>true</tt>.
431
440
  # * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
432
441
  # really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name
433
442
  # of an OpenSSL verify constant (<tt>'none'</tt> or <tt>'peer'</tt>) or directly the constant
434
- # (<tt>OpenSSL::SSL::VERIFY_NONE</tt> or <tt>OpenSSL::SSL::VERIFY_PEER</tt>).
443
+ # (+OpenSSL::SSL::VERIFY_NONE+ or +OpenSSL::SSL::VERIFY_PEER+).
435
444
  # * <tt>:ssl/:tls</tt> Enables the SMTP connection to use SMTP/TLS (SMTPS: SMTP over direct TLS connection)
436
445
  # * <tt>:open_timeout</tt> Number of seconds to wait while attempting to open a connection.
437
446
  # * <tt>:read_timeout</tt> Number of seconds to wait until timing-out a read(2) call.
438
447
  #
439
448
  # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
440
449
  # * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
441
- # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i</tt> with <tt>-f sender@address</tt>
450
+ # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>%w[ -i ]</tt> with <tt>-f sender@address</tt>
442
451
  # added automatically before the message is sent.
443
452
  #
444
453
  # * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.
@@ -459,15 +468,19 @@ module ActionMailer
459
468
  # * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
460
469
  # <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
461
470
  #
462
- # * <tt>delivery_job</tt> - The job class used with <tt>deliver_later</tt>. Defaults to
463
- # +ActionMailer::MailDeliveryJob+.
471
+ # * <tt>delivery_job</tt> - The job class used with <tt>deliver_later</tt>. Mailers can set this to use a
472
+ # custom delivery job. Defaults to +ActionMailer::MailDeliveryJob+.
464
473
  #
465
- # * <tt>deliver_later_queue_name</tt> - The name of the queue used with <tt>deliver_later</tt>.
474
+ # * <tt>deliver_later_queue_name</tt> - The queue name used by <tt>deliver_later</tt> with the default
475
+ # <tt>delivery_job</tt>. Mailers can set this to use a custom queue name.
466
476
  class Base < AbstractController::Base
477
+ include Callbacks
467
478
  include DeliveryMethods
479
+ include QueuedDelivery
468
480
  include Rescuable
469
481
  include Parameterized
470
482
  include Previews
483
+ include FormBuilder
471
484
 
472
485
  abstract!
473
486
 
@@ -486,7 +499,6 @@ module ActionMailer
486
499
 
487
500
  helper ActionMailer::MailHelper
488
501
 
489
- class_attribute :delivery_job, default: ::ActionMailer::MailDeliveryJob
490
502
  class_attribute :default_params, default: {
491
503
  mime_version: "1.0",
492
504
  charset: "UTF-8",
@@ -576,11 +588,11 @@ module ActionMailer
576
588
  # config.action_mailer.default_options = { from: "no-reply@example.org" }
577
589
  alias :default_options= :default
578
590
 
579
- # Wraps an email delivery inside of <tt>ActiveSupport::Notifications</tt> instrumentation.
591
+ # Wraps an email delivery inside of ActiveSupport::Notifications instrumentation.
580
592
  #
581
- # This method is actually called by the <tt>Mail::Message</tt> object itself
582
- # through a callback when you call <tt>:deliver</tt> on the <tt>Mail::Message</tt>,
583
- # calling +deliver_mail+ directly and passing a <tt>Mail::Message</tt> will do
593
+ # This method is actually called by the +Mail::Message+ object itself
594
+ # through a callback when you call <tt>:deliver</tt> on the +Mail::Message+,
595
+ # calling +deliver_mail+ directly and passing a +Mail::Message+ will do
584
596
  # nothing except tell the logger you sent the email.
585
597
  def deliver_mail(mail) # :nodoc:
586
598
  ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload|
@@ -674,18 +686,18 @@ module ActionMailer
674
686
  self.class.email_address_with_name(address, name)
675
687
  end
676
688
 
677
- # Allows you to pass random and unusual headers to the new <tt>Mail::Message</tt>
689
+ # Allows you to pass random and unusual headers to the new +Mail::Message+
678
690
  # object which will add them to itself.
679
691
  #
680
692
  # headers['X-Special-Domain-Specific-Header'] = "SecretValue"
681
693
  #
682
694
  # You can also pass a hash into headers of header field names and values,
683
- # which will then be set on the <tt>Mail::Message</tt> object:
695
+ # which will then be set on the +Mail::Message+ object:
684
696
  #
685
697
  # headers 'X-Special-Domain-Specific-Header' => "SecretValue",
686
698
  # 'In-Reply-To' => incoming.message_id
687
699
  #
688
- # The resulting <tt>Mail::Message</tt> will have the following in its header:
700
+ # The resulting +Mail::Message+ will have the following in its header:
689
701
  #
690
702
  # X-Special-Domain-Specific-Header: SecretValue
691
703
  #
@@ -721,7 +733,7 @@ module ActionMailer
721
733
  # mail.attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
722
734
  #
723
735
  # If you do this, then Mail will take the file name and work out the mime type.
724
- # It will also set the Content-Type, Content-Disposition, Content-Transfer-Encoding
736
+ # It will also set the +Content-Type+, +Content-Disposition+, and +Content-Transfer-Encoding+,
725
737
  # and encode the contents of the attachment in Base64.
726
738
  #
727
739
  # You can also specify overrides if you want by passing a hash instead of a string:
@@ -772,7 +784,7 @@ module ActionMailer
772
784
  # the most used headers in an email message, these are:
773
785
  #
774
786
  # * +:subject+ - The subject of the message, if this is omitted, Action Mailer will
775
- # ask the Rails I18n class for a translated +:subject+ in the scope of
787
+ # ask the \Rails I18n class for a translated +:subject+ in the scope of
776
788
  # <tt>[mailer_scope, action_name]</tt> or if this is missing, will translate the
777
789
  # humanized version of the +action_name+
778
790
  # * +:to+ - Who the message is destined for, can be a string of addresses, or an array
@@ -782,7 +794,7 @@ module ActionMailer
782
794
  # or an array of addresses.
783
795
  # * +:bcc+ - Who you would like to Blind-Carbon-Copy on this email, can be a string of
784
796
  # addresses, or an array of addresses.
785
- # * +:reply_to+ - Who to set the Reply-To header of the email to.
797
+ # * +:reply_to+ - Who to set the +Reply-To+ header of the email to.
786
798
  # * +:date+ - The date to say the email was sent on.
787
799
  #
788
800
  # You can set default values for any of the above headers (except +:date+)
@@ -809,7 +821,7 @@ module ActionMailer
809
821
  # templates in the view paths using by default the mailer name and the
810
822
  # method name that it is being called from, it will then create parts for
811
823
  # each of these templates intelligently, making educated guesses on correct
812
- # content type and sequence, and return a fully prepared <tt>Mail::Message</tt>
824
+ # content type and sequence, and return a fully prepared +Mail::Message+
813
825
  # ready to call <tt>:deliver</tt> on to send.
814
826
  #
815
827
  # For example:
@@ -918,7 +930,7 @@ module ActionMailer
918
930
  end
919
931
  end
920
932
 
921
- # Translates the +subject+ using Rails I18n class under <tt>[mailer_scope, action_name]</tt> scope.
933
+ # Translates the +subject+ using \Rails I18n class under <tt>[mailer_scope, action_name]</tt> scope.
922
934
  # If it does not find a translation for the +subject+ under the specified scope it will default to a
923
935
  # humanized version of the <tt>action_name</tt>.
924
936
  # If the subject has interpolations, you can pass them through the +interpolations+ parameter.