actionmailer 7.0.8 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb225f1d101e6ebb7bb1313efb10362cf154ba1e9409c1123a8c5723367d5384
4
- data.tar.gz: d4ff3e32a4c448d59981162eeccda1a6eead0692428a4702139576062adfc4b1
3
+ metadata.gz: 9aa316d8511b6c4f46020fb26944448c0e57a447ba880add9e4abfb5d1ab521f
4
+ data.tar.gz: 8c05c5ddf934c6871811714e42d1be9150fd5f1d906ab74da65e4daf49c32547
5
5
  SHA512:
6
- metadata.gz: 04cc3d547ce2389798d852f0d0b08019bef1cf02fa11407d57f153cd7cc286eb27f3586dd350fa7ced41328ee83f822609a12f332c22616610544e6c6c64010d
7
- data.tar.gz: d582a8355f8804bd10bf760e328eea26dd128bb32f9a82af9c291bec3d240169d1dded62a35840cb93881749533a8c851bc4f9eceeab537e8e31bb33a400e5f1
6
+ metadata.gz: 182da14d590a4aac24876b137c4902d214ec38f108b34fa36261ae5ec44ce544730924164313722871a5148aa37cbbd1ec03290431e23fca7e745c48ce639683
7
+ data.tar.gz: 923bfd5dec3d11250d5dee0ca07333ebd17e25a053e4ac3bc0e09dbc594f2cec766b3d30aa9a70d17d7ebdeda0ae27bef28dcc6e8b13469c20f361633077959a
data/CHANGELOG.md CHANGED
@@ -1,136 +1,148 @@
1
- ## Rails 7.0.8 (September 09, 2023) ##
1
+ ## Rails 7.1.1 (October 11, 2023) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 7.0.7.2 (August 22, 2023) ##
6
+ ## Rails 7.1.0 (October 05, 2023) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 7.0.7.1 (August 22, 2023) ##
11
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 7.0.7 (August 09, 2023) ##
16
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
17
17
 
18
- * No changes.
19
-
20
-
21
- ## Rails 7.0.6 (June 29, 2023) ##
22
-
23
- * No changes.
24
-
25
-
26
- ## Rails 7.0.5.1 (June 26, 2023) ##
27
-
28
- * No changes.
29
-
30
-
31
- ## Rails 7.0.5 (May 24, 2023) ##
32
-
33
- * No changes.
34
-
35
-
36
- ## Rails 7.0.4.3 (March 13, 2023) ##
37
-
38
- * No changes.
39
-
40
-
41
- ## Rails 7.0.4.2 (January 24, 2023) ##
42
-
43
- * No changes.
44
-
45
-
46
- ## Rails 7.0.4.1 (January 17, 2023) ##
47
-
48
- * No changes.
18
+ * Introduce `ActionMailer::FormBuilder`
49
19
 
20
+ Use the `default_form_builder` method in mailers to set the default form builder
21
+ for templates rendered by that mailer. Matches the behaviour in Action Controller.
50
22
 
51
- ## Rails 7.0.4 (September 09, 2022) ##
23
+ *Alex Ghiculescu*
52
24
 
53
- * No changes.
54
25
 
26
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
55
27
 
56
- ## Rails 7.0.3.1 (July 12, 2022) ##
28
+ * Mailers are listed in alphabetical order on the mailer preview page now.
57
29
 
58
- * No changes.
30
+ *Martin Spickermann*
59
31
 
32
+ * Deprecate passing params to `assert_enqueued_email_with` via the `:args`
33
+ kwarg. `assert_enqueued_email_with` now supports a `:params` kwarg, so use
34
+ that to pass params:
60
35
 
61
- ## Rails 7.0.3 (May 09, 2022) ##
36
+ ```ruby
37
+ # BEFORE
38
+ assert_enqueued_email_with MyMailer, :my_method, args: { my_param: "value" }
62
39
 
63
- * No changes.
40
+ # AFTER
41
+ assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" }
42
+ ```
64
43
 
44
+ To specify named mailer args as a Hash, wrap the Hash in an array:
65
45
 
66
- ## Rails 7.0.2.4 (April 26, 2022) ##
46
+ ```ruby
47
+ assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }]
48
+ # OR
49
+ assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"]
50
+ ```
67
51
 
68
- * No changes.
52
+ *Jonathan Hefner*
69
53
 
54
+ * Accept procs for args and params in `assert_enqueued_email_with`
70
55
 
71
- ## Rails 7.0.2.3 (March 08, 2022) ##
56
+ ```ruby
57
+ assert_enqueued_email_with DeliveryJob, params: -> p { p[:token] =~ /\w+/ } do
58
+ UserMailer.with(token: user.generate_token).email_verification.deliver_later
59
+ end
60
+ ```
72
61
 
73
- * No changes.
62
+ *Max Chernyak*
74
63
 
64
+ * Added `*_deliver` callbacks to `ActionMailer::Base` that wrap mail message delivery.
75
65
 
76
- ## Rails 7.0.2.2 (February 11, 2022) ##
66
+ Example:
77
67
 
78
- * No changes.
68
+ ```ruby
69
+ class EventsMailer < ApplicationMailer
70
+ after_deliver do
71
+ User.find_by(email: message.to.first).update(email_provider_id: message.message_id, emailed_at: Time.current)
72
+ end
73
+ end
74
+ ```
79
75
 
76
+ *Ben Sheldon*
80
77
 
81
- ## Rails 7.0.2.1 (February 11, 2022) ##
78
+ * Added `deliver_enqueued_emails` to `ActionMailer::TestHelper`. This method
79
+ delivers all enqueued email jobs.
82
80
 
83
- * No changes.
81
+ Example:
84
82
 
83
+ ```ruby
84
+ def test_deliver_enqueued_emails
85
+ deliver_enqueued_emails do
86
+ ContactMailer.welcome.deliver_later
87
+ end
88
+ assert_emails 1
89
+ end
90
+ ```
85
91
 
86
- ## Rails 7.0.2 (February 08, 2022) ##
92
+ *Andrew Novoselac*
87
93
 
88
- * No changes.
94
+ * The `deliver_later_queue_name` used by the default mailer job can now be
95
+ configured on a per-mailer basis. Previously this was only configurable
96
+ for all mailers via `ActionMailer::Base`.
89
97
 
98
+ Example:
90
99
 
91
- ## Rails 7.0.1 (January 06, 2022) ##
100
+ ```ruby
101
+ class EventsMailer < ApplicationMailer
102
+ self.deliver_later_queue_name = :throttled_mailer
103
+ end
104
+ ```
92
105
 
93
- * Keep configuration of `smtp_settings` consistent between 6.1 and 7.0.
106
+ *Jeffrey Hardy*
94
107
 
95
- *André Luis Leal Cardoso Junior*
108
+ * Email previews now include an expandable section to show all headers.
96
109
 
110
+ Headers like `Message-ID` for threading or email service provider specific
111
+ features like analytics tags or account metadata can now be viewed directly
112
+ in the mailer preview.
97
113
 
98
- ## Rails 7.0.0 (December 15, 2021) ##
114
+ *Matt Swanson*
99
115
 
100
- * No changes.
116
+ * Default `ActionMailer::Parameterized#params` to an empty `Hash`
101
117
 
118
+ *Sean Doyle*
102
119
 
103
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
120
+ * Introduce the `capture_emails` test helper.
104
121
 
105
- * No changes.
122
+ Returns all emails that are sent in a block.
106
123
 
124
+ ```ruby
125
+ def test_emails
126
+ emails = capture_emails do
127
+ ContactMailer.welcome.deliver_now
128
+ ContactMailer.welcome.deliver_later
129
+ end
130
+ assert_email "Hi there", emails.first.subject
131
+ end
132
+ ```
107
133
 
108
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
109
-
110
- * No changes.
111
-
112
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
113
-
114
- * Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
115
- in favor of `ActionMailer::MailDeliveryJob`.
116
-
117
- *Rafael Mendonça França*
118
-
119
- * `email_address_with_name` returns just the address if name is blank.
120
-
121
- *Thomas Hutterer*
122
-
123
-
124
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
125
-
126
- * No changes.
134
+ *Alex Ghiculescu*
127
135
 
136
+ * Added ability to download `.eml` file for the email preview.
128
137
 
129
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
138
+ *Igor Kasyanchuk*
130
139
 
131
- * Configures a default of 5 for both `open_timeout` and `read_timeout` for SMTP Settings.
140
+ * Support multiple preview paths for mailers.
132
141
 
133
- *André Luis Leal Cardoso Junior*
142
+ Option `config.action_mailer.preview_path` is deprecated in favor of
143
+ `config.action_mailer.preview_paths`. Appending paths to this configuration option
144
+ will cause those paths to be used in the search for mailer previews.
134
145
 
146
+ *fatkodima*
135
147
 
136
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailer/CHANGELOG.md) for previous changes.
148
+ 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,
@@ -10,6 +10,8 @@ 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
17
  # = Mailer Models
@@ -19,7 +21,7 @@ module ActionMailer
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
@@ -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
@@ -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
@@ -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.
@@ -368,7 +376,7 @@ module ActionMailer
368
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.
@@ -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
  #
@@ -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
@@ -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.
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionMailer
4
+ module Callbacks
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ include ActiveSupport::Callbacks
9
+ define_callbacks :deliver, skip_after_callbacks_if_terminated: true
10
+ end
11
+
12
+ module ClassMethods
13
+ # Defines a callback that will get called right before the
14
+ # message is sent to the delivery method.
15
+ def before_deliver(*filters, &blk)
16
+ set_callback(:deliver, :before, *filters, &blk)
17
+ end
18
+
19
+ # Defines a callback that will get called right after the
20
+ # message's delivery method is finished.
21
+ def after_deliver(*filters, &blk)
22
+ set_callback(:deliver, :after, *filters, &blk)
23
+ end
24
+
25
+ # Defines a callback that will get called around the message's deliver method.
26
+ def around_deliver(*filters, &blk)
27
+ set_callback(:deliver, :around, *filters, &blk)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -3,6 +3,8 @@
3
3
  require "tmpdir"
4
4
 
5
5
  module ActionMailer
6
+ # = Action Mailer \DeliveryMethods
7
+ #
6
8
  # This module handles everything related to mail delivery, from registering
7
9
  # new delivery methods to configuring the mail object to be sent.
8
10
  module DeliveryMethods
@@ -12,7 +14,6 @@ module ActionMailer
12
14
  # Do not make this inheritable, because we always want it to propagate
13
15
  cattr_accessor :raise_delivery_errors, default: true
14
16
  cattr_accessor :perform_deliveries, default: true
15
- cattr_accessor :deliver_later_queue_name, default: :mailers
16
17
 
17
18
  class_attribute :delivery_methods, default: {}.freeze
18
19
  class_attribute :delivery_method, default: :smtp
@@ -31,7 +32,8 @@ module ActionMailer
31
32
 
32
33
  add_delivery_method :sendmail, Mail::Sendmail,
33
34
  location: "/usr/sbin/sendmail",
34
- arguments: "-i"
35
+ # See breaking change in the mail gem - https://github.com/mikel/mail/commit/7e1196bd29815a0901d7290c82a332c0959b163a
36
+ arguments: Gem::Version.new(Mail::VERSION.version) >= Gem::Version.new("2.8.0") ? %w[-i] : "-i"
35
37
 
36
38
  add_delivery_method :test, Mail::TestMailer
37
39
  end
@@ -46,7 +48,7 @@ module ActionMailer
46
48
  #
47
49
  # add_delivery_method :sendmail, Mail::Sendmail,
48
50
  # location: '/usr/sbin/sendmail',
49
- # arguments: '-i'
51
+ # arguments: %w[ -i ]
50
52
  def add_delivery_method(symbol, klass, default_options = {})
51
53
  class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
52
54
  public_send(:"#{symbol}_settings=", default_options)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionMailer
4
+ def self.deprecator # :nodoc:
5
+ @deprecator ||= ActiveSupport::Deprecation.new
6
+ end
7
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionMailer
4
+ # = Action Mailer Form Builder
5
+ #
6
+ # Override the default form builder for all views rendered by this
7
+ # mailer and any of its descendants. Accepts a subclass of
8
+ # ActionView::Helpers::FormBuilder.
9
+ #
10
+ # While emails typically will not include forms, this can be used
11
+ # by views that are shared between controllers and mailers.
12
+ #
13
+ # For more information, see +ActionController::FormBuilder+.
14
+ module FormBuilder
15
+ extend ActiveSupport::Concern
16
+
17
+ included do
18
+ class_attribute :_default_form_builder, instance_accessor: false
19
+ end
20
+
21
+ module ClassMethods
22
+ # Set the form builder to be used as the default for all forms
23
+ # in the views rendered by this mailer and its subclasses.
24
+ #
25
+ # ==== Parameters
26
+ # * <tt>builder</tt> - Default form builder, an instance of ActionView::Helpers::FormBuilder
27
+ def default_form_builder(builder)
28
+ self._default_form_builder = builder
29
+ end
30
+ end
31
+
32
+ # Default form builder for the mailer
33
+ def default_form_builder
34
+ self.class._default_form_builder
35
+ end
36
+ end
37
+ end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionMailer
4
- # Returns the currently loaded version of Action Mailer as a <tt>Gem::Version</tt>.
4
+ # Returns the currently loaded version of Action Mailer as a +Gem::Version+.
5
5
  def self.gem_version
6
6
  Gem::Version.new VERSION::STRING
7
7
  end
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 7
11
- MINOR = 0
12
- TINY = 8
11
+ MINOR = 1
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -3,6 +3,8 @@
3
3
  require "base64"
4
4
 
5
5
  module ActionMailer
6
+ # = Action Mailer \InlinePreviewInterceptor
7
+ #
6
8
  # Implements a mailer preview interceptor that converts image tag src attributes
7
9
  # that use inline cid: style URLs to data: style URLs so that they are visible
8
10
  # when previewing an HTML email in a web browser.