actionmailer 6.1.7.3 → 7.0.3

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: 6bb7ffb601a9568b38939b5ab3c1863b4af0df166e687c10170de6cd56f2cecb
4
- data.tar.gz: fc0f8a8bdc175073092dd279c053f029bce8a88a2fafad728adaa2c2529daf66
3
+ metadata.gz: 606a202b5233ac024500fda4724b2ee15c44e7916a3c762c223d331c9e913dd1
4
+ data.tar.gz: 177877e43234919d5d8718a3b110ff12483a977c3864b40f703ddfa53c20be9c
5
5
  SHA512:
6
- metadata.gz: f7b8cb8d5e3d45d1bbd8c6788c9705e547664ea9294853f838ea75d1110de87b29eb6770756ba27b70b03c521f777850e99486a3cee39808b781589c39bb99a6
7
- data.tar.gz: 57e1ade257d3f63bb3496de9bad6b09a449182a6e5679e83064e08741e005a7d444d19b29204f32228ac35dab767518ecd9bfc30ad0c7e7e06a0deba459b07b7
6
+ metadata.gz: 8c602239cbd2cdb420adccf493e1713be2759f2e492e536ca39ee7b8a86beea995df128b97f56c3107756dac4a1416fea086a2f600dc95722891ad806a7f330b
7
+ data.tar.gz: 8321114bdae2bb871c2e521fdc08885e235b39baa6f0654be1ba1e9ee5443224694a40817b6f8ce68104b42b3f378320e432f6c711e6d3aadd886910c6624234
data/CHANGELOG.md CHANGED
@@ -1,133 +1,76 @@
1
- ## Rails 6.1.7.3 (March 13, 2023) ##
1
+ ## Rails 7.0.3 (May 09, 2022) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 6.1.7.2 (January 24, 2023) ##
6
+ ## Rails 7.0.2.4 (April 26, 2022) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 6.1.7.1 (January 17, 2023) ##
11
+ ## Rails 7.0.2.3 (March 08, 2022) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 6.1.7 (September 09, 2022) ##
16
+ ## Rails 7.0.2.2 (February 11, 2022) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 6.1.6.1 (July 12, 2022) ##
21
+ ## Rails 7.0.2.1 (February 11, 2022) ##
22
22
 
23
23
  * No changes.
24
24
 
25
25
 
26
- ## Rails 6.1.6 (May 09, 2022) ##
26
+ ## Rails 7.0.2 (February 08, 2022) ##
27
27
 
28
28
  * No changes.
29
29
 
30
30
 
31
- ## Rails 6.1.5.1 (April 26, 2022) ##
32
-
33
- * No changes.
34
-
35
-
36
- ## Rails 6.1.5 (March 09, 2022) ##
37
-
38
- * No changes.
39
-
40
-
41
- ## Rails 6.1.4.7 (March 08, 2022) ##
42
-
43
- * No changes.
44
-
45
-
46
- ## Rails 6.1.4.6 (February 11, 2022) ##
47
-
48
- * No changes.
49
-
50
-
51
- ## Rails 6.1.4.5 (February 11, 2022) ##
52
-
53
- * No changes.
54
-
55
-
56
- ## Rails 6.1.4.4 (December 15, 2021) ##
57
-
58
- * No changes.
59
-
60
-
61
- ## Rails 6.1.4.3 (December 14, 2021) ##
62
-
63
- * No changes.
64
-
65
-
66
- ## Rails 6.1.4.2 (December 14, 2021) ##
67
-
68
- * No changes.
31
+ ## Rails 7.0.1 (January 06, 2022) ##
69
32
 
33
+ * Keep configuration of `smtp_settings` consistent between 6.1 and 7.0.
70
34
 
71
- ## Rails 6.1.4.1 (August 19, 2021) ##
72
-
73
- * No changes.
35
+ *André Luis Leal Cardoso Junior*
74
36
 
75
37
 
76
- ## Rails 6.1.4 (June 24, 2021) ##
38
+ ## Rails 7.0.0 (December 15, 2021) ##
77
39
 
78
40
  * No changes.
79
41
 
80
42
 
81
- ## Rails 6.1.3.2 (May 05, 2021) ##
43
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
82
44
 
83
45
  * No changes.
84
46
 
85
47
 
86
- ## Rails 6.1.3.1 (March 26, 2021) ##
48
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
87
49
 
88
50
  * No changes.
89
51
 
52
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
90
53
 
91
- ## Rails 6.1.3 (February 17, 2021) ##
92
-
93
- * No changes.
54
+ * Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
55
+ in favor of `ActionMailer::MailDeliveryJob`.
94
56
 
57
+ *Rafael Mendonça França*
95
58
 
96
- ## Rails 6.1.2.1 (February 10, 2021) ##
59
+ * `email_address_with_name` returns just the address if name is blank.
97
60
 
98
- * No changes.
61
+ *Thomas Hutterer*
99
62
 
100
63
 
101
- ## Rails 6.1.2 (February 09, 2021) ##
64
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
102
65
 
103
66
  * No changes.
104
67
 
105
68
 
106
- ## Rails 6.1.1 (January 07, 2021) ##
107
-
108
- * Sets default mailer queue to `"default"` in the mail assertions.
109
-
110
- *Paul Keen*
111
-
112
-
113
- ## Rails 6.1.0 (December 09, 2020) ##
114
-
115
- * Change default queue name of the deliver (`:mailers`) job to be the job adapter's
116
- default (`:default`).
117
-
118
- *Rafael Mendonça França*
119
-
120
- * Remove deprecated `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
121
-
122
- *Rafael Mendonça França*
123
-
124
- * Fix ActionMailer assertions don't work for parameterized mail with legacy delivery job.
125
-
126
- *bogdanvlviv*
69
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
127
70
 
128
- * Added `email_address_with_name` to properly escape addresses with names.
71
+ * Configures a default of 5 for both `open_timeout` and `read_timeout` for SMTP Settings.
129
72
 
130
- *Sunny Ripert*
73
+ *André Luis Leal Cardoso Junior*
131
74
 
132
75
 
133
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionmailer/CHANGELOG.md) for previous changes.
76
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailer/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -18,3 +18,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "action_mailer/mail_with_error_handling"
3
+ require "mail"
4
4
  require "action_mailer/collector"
5
5
  require "active_support/core_ext/string/inflections"
6
6
  require "active_support/core_ext/hash/except"
@@ -106,7 +106,7 @@ module ActionMailer
106
106
  # You got a new note!
107
107
  # <%= truncate(@note.body, length: 25) %>
108
108
  #
109
- # If you need to access the subject, from or the recipients in the view, you can do that through message object:
109
+ # If you need to access the subject, from, or the recipients in the view, you can do that through message object:
110
110
  #
111
111
  # You got a new note from <%= message.from %>!
112
112
  # <%= truncate(@note.body, length: 25) %>
@@ -149,9 +149,9 @@ module ActionMailer
149
149
  # mail = NotifierMailer.welcome(User.first) # => an ActionMailer::MessageDelivery object
150
150
  # mail.deliver_now # generates and sends the email now
151
151
  #
152
- # The <tt>ActionMailer::MessageDelivery</tt> class is a wrapper around a delegate that will call
152
+ # The ActionMailer::MessageDelivery class is a wrapper around a delegate that will call
153
153
  # your method to generate the mail. If you want direct access to the delegator, or <tt>Mail::Message</tt>,
154
- # you can call the <tt>message</tt> method on the <tt>ActionMailer::MessageDelivery</tt> object.
154
+ # you can call the <tt>message</tt> method on the ActionMailer::MessageDelivery object.
155
155
  #
156
156
  # NotifierMailer.welcome(User.first).message # => a Mail::Message object
157
157
  #
@@ -334,14 +334,37 @@ module ActionMailer
334
334
  # end
335
335
  #
336
336
  # Callbacks in Action Mailer are implemented using
337
- # <tt>AbstractController::Callbacks</tt>, so you can define and configure
337
+ # AbstractController::Callbacks, so you can define and configure
338
338
  # callbacks in the same manner that you would use callbacks in classes that
339
- # inherit from <tt>ActionController::Base</tt>.
339
+ # inherit from ActionController::Base.
340
340
  #
341
341
  # Note that unless you have a specific reason to do so, you should prefer
342
342
  # using <tt>before_action</tt> rather than <tt>after_action</tt> in your
343
343
  # Action Mailer classes so that headers are parsed properly.
344
344
  #
345
+ # = Rescuing Errors
346
+ #
347
+ # +rescue+ blocks inside of a mailer method cannot rescue errors that occur
348
+ # outside of rendering -- for example, record deserialization errors in a
349
+ # background job, or errors from a third-party mail delivery service.
350
+ #
351
+ # To rescue errors that occur during any part of the mailing process, use
352
+ # {rescue_from}[rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from]:
353
+ #
354
+ # class NotifierMailer < ApplicationMailer
355
+ # rescue_from ActiveJob::DeserializationError do
356
+ # # ...
357
+ # end
358
+ #
359
+ # rescue_from "SomeThirdPartyService::ApiError" do
360
+ # # ...
361
+ # end
362
+ #
363
+ # def notify(recipient)
364
+ # mail(to: recipient, subject: "Notification")
365
+ # end
366
+ # end
367
+ #
345
368
  # = Previewing emails
346
369
  #
347
370
  # You can preview your email templates visually by adding a mailer preview file to the
@@ -402,6 +425,7 @@ module ActionMailer
402
425
  # This is a symbol and one of <tt>:plain</tt> (will send the password Base64 encoded), <tt>:login</tt> (will
403
426
  # send the password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
404
427
  # 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>.
405
429
  # * <tt>:enable_starttls_auto</tt> - Detects if STARTTLS is enabled in your SMTP server and starts
406
430
  # to use it. Defaults to <tt>true</tt>.
407
431
  # * <tt>:openssl_verify_mode</tt> - When using TLS, you can set how OpenSSL checks the certificate. This is
@@ -409,6 +433,8 @@ module ActionMailer
409
433
  # of an OpenSSL verify constant (<tt>'none'</tt> or <tt>'peer'</tt>) or directly the constant
410
434
  # (<tt>OpenSSL::SSL::VERIFY_NONE</tt> or <tt>OpenSSL::SSL::VERIFY_PEER</tt>).
411
435
  # * <tt>:ssl/:tls</tt> Enables the SMTP connection to use SMTP/TLS (SMTPS: SMTP over direct TLS connection)
436
+ # * <tt>:open_timeout</tt> Number of seconds to wait while attempting to open a connection.
437
+ # * <tt>:read_timeout</tt> Number of seconds to wait until timing-out a read(2) call.
412
438
  #
413
439
  # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
414
440
  # * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
@@ -433,7 +459,10 @@ module ActionMailer
433
459
  # * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
434
460
  # <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
435
461
  #
436
- # * <tt>deliver_later_queue_name</tt> - The name of the queue used with <tt>deliver_later</tt>. Defaults to +mailers+.
462
+ # * <tt>delivery_job</tt> - The job class used with <tt>deliver_later</tt>. Defaults to
463
+ # +ActionMailer::MailDeliveryJob+.
464
+ #
465
+ # * <tt>deliver_later_queue_name</tt> - The name of the queue used with <tt>deliver_later</tt>.
437
466
  class Base < AbstractController::Base
438
467
  include DeliveryMethods
439
468
  include Rescuable
@@ -457,7 +486,7 @@ module ActionMailer
457
486
 
458
487
  helper ActionMailer::MailHelper
459
488
 
460
- class_attribute :delivery_job, default: ::ActionMailer::DeliveryJob
489
+ class_attribute :delivery_job, default: ::ActionMailer::MailDeliveryJob
461
490
  class_attribute :default_params, default: {
462
491
  mime_version: "1.0",
463
492
  charset: "UTF-8",
@@ -487,28 +516,28 @@ module ActionMailer
487
516
  end
488
517
 
489
518
  # Register an Observer which will be notified when mail is delivered.
490
- # Either a class, string or symbol can be passed in as the Observer.
519
+ # Either a class, string, or symbol can be passed in as the Observer.
491
520
  # If a string or symbol is passed in it will be camelized and constantized.
492
521
  def register_observer(observer)
493
522
  Mail.register_observer(observer_class_for(observer))
494
523
  end
495
524
 
496
525
  # Unregister a previously registered Observer.
497
- # Either a class, string or symbol can be passed in as the Observer.
526
+ # Either a class, string, or symbol can be passed in as the Observer.
498
527
  # If a string or symbol is passed in it will be camelized and constantized.
499
528
  def unregister_observer(observer)
500
529
  Mail.unregister_observer(observer_class_for(observer))
501
530
  end
502
531
 
503
532
  # Register an Interceptor which will be called before mail is sent.
504
- # Either a class, string or symbol can be passed in as the Interceptor.
533
+ # Either a class, string, or symbol can be passed in as the Interceptor.
505
534
  # If a string or symbol is passed in it will be camelized and constantized.
506
535
  def register_interceptor(interceptor)
507
536
  Mail.register_interceptor(observer_class_for(interceptor))
508
537
  end
509
538
 
510
539
  # Unregister a previously registered Interceptor.
511
- # Either a class, string or symbol can be passed in as the Interceptor.
540
+ # Either a class, string, or symbol can be passed in as the Interceptor.
512
541
  # If a string or symbol is passed in it will be camelized and constantized.
513
542
  def unregister_interceptor(interceptor)
514
543
  Mail.unregister_interceptor(observer_class_for(interceptor))
@@ -553,7 +582,7 @@ module ActionMailer
553
582
  # through a callback when you call <tt>:deliver</tt> on the <tt>Mail::Message</tt>,
554
583
  # calling +deliver_mail+ directly and passing a <tt>Mail::Message</tt> will do
555
584
  # nothing except tell the logger you sent the email.
556
- def deliver_mail(mail) #:nodoc:
585
+ def deliver_mail(mail) # :nodoc:
557
586
  ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload|
558
587
  set_payload_for_mail(payload, mail)
559
588
  yield # Let Mail do the delivery actions
@@ -561,10 +590,12 @@ module ActionMailer
561
590
  end
562
591
 
563
592
  # Returns an email in the format "Name <email@example.com>".
593
+ #
594
+ # If the name is a blank string, it returns just the address.
564
595
  def email_address_with_name(address, name)
565
596
  Mail::Address.new.tap do |builder|
566
597
  builder.address = address
567
- builder.display_name = name
598
+ builder.display_name = name.presence
568
599
  end.to_s
569
600
  end
570
601
 
@@ -589,7 +620,7 @@ module ActionMailer
589
620
  super
590
621
  end
591
622
  end
592
- ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
623
+ ruby2_keywords(:method_missing)
593
624
 
594
625
  def respond_to_missing?(method, include_all = false)
595
626
  action_methods.include?(method.to_s) || super
@@ -604,7 +635,7 @@ module ActionMailer
604
635
  @_message = Mail.new
605
636
  end
606
637
 
607
- def process(method_name, *args) #:nodoc:
638
+ def process(method_name, *args) # :nodoc:
608
639
  payload = {
609
640
  mailer: self.class.name,
610
641
  action: method_name,
@@ -616,8 +647,9 @@ module ActionMailer
616
647
  @_message = NullMail.new unless @_mail_was_called
617
648
  end
618
649
  end
650
+ ruby2_keywords(:process)
619
651
 
620
- class NullMail #:nodoc:
652
+ class NullMail # :nodoc:
621
653
  def body; "" end
622
654
  def header; {} end
623
655
 
@@ -636,6 +668,8 @@ module ActionMailer
636
668
  end
637
669
 
638
670
  # Returns an email in the format "Name <email@example.com>".
671
+ #
672
+ # If the name is a blank string, it returns just the address.
639
673
  def email_address_with_name(address, name)
640
674
  self.class.email_address_with_name(address, name)
641
675
  end
@@ -899,7 +933,7 @@ module ActionMailer
899
933
  end
900
934
 
901
935
  def apply_defaults(headers)
902
- default_values = self.class.default.transform_values do |value|
936
+ default_values = self.class.default.except(*headers.keys).transform_values do |value|
903
937
  compute_default(value)
904
938
  end
905
939
 
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionMailer
4
- # Returns the version of the currently loaded Action Mailer as a <tt>Gem::Version</tt>.
4
+ # Returns the currently loaded version of Action Mailer as a <tt>Gem::Version</tt>.
5
5
  def self.gem_version
6
6
  Gem::Version.new VERSION::STRING
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 6
11
- MINOR = 1
12
- TINY = 7
13
- PRE = "3"
10
+ MAJOR = 7
11
+ MINOR = 0
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -17,15 +17,15 @@ module ActionMailer
17
17
 
18
18
  include Base64
19
19
 
20
- def self.previewing_email(message) #:nodoc:
20
+ def self.previewing_email(message) # :nodoc:
21
21
  new(message).transform!
22
22
  end
23
23
 
24
- def initialize(message) #:nodoc:
24
+ def initialize(message) # :nodoc:
25
25
  @message = message
26
26
  end
27
27
 
28
- def transform! #:nodoc:
28
+ def transform! # :nodoc:
29
29
  return message if html_part.blank?
30
30
 
31
31
  html_part.body = html_part.decoded.gsub(PATTERN) do |match|
@@ -15,7 +15,7 @@ module ActionMailer
15
15
  # Notifier.welcome(User.first).deliver_later # enqueue email delivery as a job through Active Job
16
16
  # Notifier.welcome(User.first).message # a Mail::Message object
17
17
  class MessageDelivery < Delegator
18
- def initialize(mailer_class, action, *args) #:nodoc:
18
+ def initialize(mailer_class, action, *args) # :nodoc:
19
19
  @mailer_class, @action, @args = mailer_class, action, args
20
20
 
21
21
  # The mail is only processed if we try to call any methods on it.
@@ -23,15 +23,15 @@ module ActionMailer
23
23
  @processed_mailer = nil
24
24
  @mail_message = nil
25
25
  end
26
- ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)
26
+ ruby2_keywords(:initialize)
27
27
 
28
28
  # Method calls are delegated to the Mail::Message that's ready to deliver.
29
- def __getobj__ #:nodoc:
29
+ def __getobj__ # :nodoc:
30
30
  @mail_message ||= processed_mailer.message
31
31
  end
32
32
 
33
33
  # Unused except for delegator internals (dup, marshalling).
34
- def __setobj__(mail_message) #:nodoc:
34
+ def __setobj__(mail_message) # :nodoc:
35
35
  @mail_message = mail_message
36
36
  end
37
37
 
@@ -62,8 +62,8 @@ module ActionMailer
62
62
  # * <tt>:queue</tt> - Enqueue the email on the specified queue
63
63
  # * <tt>:priority</tt> - Enqueues the email with the specified priority
64
64
  #
65
- # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
66
- # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
65
+ # By default, the email will be enqueued using <tt>ActionMailer::MailDeliveryJob</tt>. Each
66
+ # ActionMailer::Base class can specify the job to use by setting the class variable
67
67
  # +delivery_job+.
68
68
  #
69
69
  # class AccountRegistrationMailer < ApplicationMailer
@@ -88,8 +88,8 @@ module ActionMailer
88
88
  # * <tt>:queue</tt> - Enqueue the email on the specified queue.
89
89
  # * <tt>:priority</tt> - Enqueues the email with the specified priority
90
90
  #
91
- # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
92
- # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
91
+ # By default, the email will be enqueued using <tt>ActionMailer::MailDeliveryJob</tt>. Each
92
+ # ActionMailer::Base class can specify the job to use by setting the class variable
93
93
  # +delivery_job+.
94
94
  #
95
95
  # class AccountRegistrationMailer < ApplicationMailer
@@ -140,38 +140,8 @@ module ActionMailer
140
140
  "#deliver_later, 2. only touch the message *within your mailer " \
141
141
  "method*, or 3. use a custom Active Job instead of #deliver_later."
142
142
  else
143
- job = @mailer_class.delivery_job
144
-
145
- if use_new_args?(job)
146
- job.set(options).perform_later(
147
- @mailer_class.name, @action.to_s, delivery_method.to_s, args: @args)
148
- elsif job <= DeliveryJob
149
- job.set(options).perform_later(
150
- @mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
151
- else
152
- ActiveSupport::Deprecation.warn(<<~EOM)
153
- In Rails 7.0, Action Mailer will pass the mail arguments inside the `:args` keyword argument.
154
- The `perform` method of the #{job} needs to change and forward the mail arguments
155
- from the `args` keyword argument.
156
-
157
- The `perform` method should now look like:
158
-
159
- `def perform(mailer, mail_method, delivery, args:)`
160
- EOM
161
-
162
- job.set(options).perform_later(
163
- @mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
164
- end
165
- end
166
- end
167
-
168
- def use_new_args?(job)
169
- parameters = job.public_instance_method(:perform).parameters
170
-
171
- parameters.find do |key, name|
172
- return true if key == :keyreq && name == :args
173
-
174
- key == :keyrest and name != :**
143
+ @mailer_class.delivery_job.set(options).perform_later(
144
+ @mailer_class.name, @action.to_s, delivery_method.to_s, args: @args)
175
145
  end
176
146
  end
177
147
  end
@@ -115,26 +115,19 @@ module ActionMailer
115
115
  super
116
116
  end
117
117
  end
118
- ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
118
+ ruby2_keywords(:method_missing)
119
119
 
120
120
  def respond_to_missing?(method, include_all = false)
121
121
  @mailer.respond_to?(method, include_all)
122
122
  end
123
123
  end
124
124
 
125
- class DeliveryJob < ActionMailer::DeliveryJob # :nodoc:
126
- def perform(mailer, mail_method, delivery_method, params, *args)
127
- mailer.constantize.with(params).public_send(mail_method, *args).send(delivery_method)
128
- end
129
- ruby2_keywords(:perform) if respond_to?(:ruby2_keywords, true)
130
- end
131
-
132
125
  class MessageDelivery < ActionMailer::MessageDelivery # :nodoc:
133
126
  def initialize(mailer_class, action, params, *args)
134
127
  super(mailer_class, action, *args)
135
128
  @params = params
136
129
  end
137
- ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)
130
+ ruby2_keywords(:initialize)
138
131
 
139
132
  private
140
133
  def processed_mailer
@@ -148,23 +141,8 @@ module ActionMailer
148
141
  if processed?
149
142
  super
150
143
  else
151
- job = delivery_job_class
152
-
153
- if job <= MailDeliveryJob
154
- job.set(options).perform_later(
155
- @mailer_class.name, @action.to_s, delivery_method.to_s, params: @params, args: @args)
156
- else
157
- job.set(options).perform_later(
158
- @mailer_class.name, @action.to_s, delivery_method.to_s, @params, *@args)
159
- end
160
- end
161
- end
162
-
163
- def delivery_job_class
164
- if @mailer_class.delivery_job <= MailDeliveryJob
165
- @mailer_class.delivery_job
166
- else
167
- Parameterized::DeliveryJob
144
+ @mailer_class.delivery_job.set(options).perform_later(
145
+ @mailer_class.name, @action.to_s, delivery_method.to_s, params: @params, args: @args)
168
146
  end
169
147
  end
170
148
  end
@@ -3,7 +3,7 @@
3
3
  require "active_support/descendants_tracker"
4
4
 
5
5
  module ActionMailer
6
- module Previews #:nodoc:
6
+ module Previews # :nodoc:
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
@@ -45,6 +45,17 @@ module ActionMailer
45
45
  self.delivery_job = delivery_job.constantize
46
46
  end
47
47
 
48
+ if options.smtp_settings
49
+ self.smtp_settings = options.smtp_settings
50
+ end
51
+
52
+ smtp_timeout = options.delete(:smtp_timeout)
53
+
54
+ if self.smtp_settings && smtp_timeout
55
+ self.smtp_settings[:open_timeout] ||= smtp_timeout
56
+ self.smtp_settings[:read_timeout] ||= smtp_timeout
57
+ end
58
+
48
59
  options.each { |k, v| send("#{k}=", v) }
49
60
  end
50
61
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ActionMailer #:nodoc:
3
+ module ActionMailer # :nodoc:
4
4
  # Provides +rescue_from+ for mailers. Wraps mailer action processing,
5
5
  # mail job processing, and mail delivery.
6
6
  module Rescuable
@@ -8,19 +8,19 @@ module ActionMailer #:nodoc:
8
8
  include ActiveSupport::Rescuable
9
9
 
10
10
  class_methods do
11
- def handle_exception(exception) #:nodoc:
11
+ def handle_exception(exception) # :nodoc:
12
12
  rescue_with_handler(exception) || raise(exception)
13
13
  end
14
14
  end
15
15
 
16
- def handle_exceptions #:nodoc:
16
+ def handle_exceptions # :nodoc:
17
17
  yield
18
18
  rescue => exception
19
19
  rescue_with_handler(exception) || raise
20
20
  end
21
21
 
22
22
  private
23
- def process(*)
23
+ def process(...)
24
24
  handle_exceptions do
25
25
  super
26
26
  end
@@ -155,8 +155,7 @@ module ActionMailer
155
155
  def delivery_job_filter(job)
156
156
  job_class = job.is_a?(Hash) ? job.fetch(:job) : job.class
157
157
 
158
- Base.descendants.map(&:delivery_job).include?(job_class) ||
159
- ActionMailer::Parameterized::DeliveryJob == job_class
158
+ Base.descendants.map(&:delivery_job).include?(job_class)
160
159
  end
161
160
  end
162
161
  end
@@ -3,7 +3,7 @@
3
3
  require_relative "gem_version"
4
4
 
5
5
  module ActionMailer
6
- # Returns the version of the currently loaded Action Mailer as a
6
+ # Returns the currently loaded version of Action Mailer as a
7
7
  # <tt>Gem::Version</tt>.
8
8
  def self.version
9
9
  gem_version
data/lib/action_mailer.rb CHANGED
@@ -51,13 +51,12 @@ module ActionMailer
51
51
  autoload :TestCase
52
52
  autoload :TestHelper
53
53
  autoload :MessageDelivery
54
- autoload :DeliveryJob
55
54
  autoload :MailDeliveryJob
56
55
 
57
56
  def self.eager_load!
58
57
  super
59
58
 
60
- require "action_mailer/mail_with_error_handling"
59
+ require "mail"
61
60
  Mail.eager_autoload!
62
61
  end
63
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.7.3
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-13 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.7.3
19
+ version: 7.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.7.3
26
+ version: 7.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 6.1.7.3
33
+ version: 7.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 6.1.7.3
40
+ version: 7.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: actionview
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 6.1.7.3
47
+ version: 7.0.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 6.1.7.3
54
+ version: 7.0.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activejob
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 6.1.7.3
61
+ version: 7.0.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 6.1.7.3
68
+ version: 7.0.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mail
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +86,48 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.5.4
89
+ - !ruby/object:Gem::Dependency
90
+ name: net-imap
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: net-pop
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: net-smtp
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
89
131
  - !ruby/object:Gem::Dependency
90
132
  name: rails-dom-testing
91
133
  requirement: !ruby/object:Gem::Requirement
@@ -113,14 +155,12 @@ files:
113
155
  - lib/action_mailer.rb
114
156
  - lib/action_mailer/base.rb
115
157
  - lib/action_mailer/collector.rb
116
- - lib/action_mailer/delivery_job.rb
117
158
  - lib/action_mailer/delivery_methods.rb
118
159
  - lib/action_mailer/gem_version.rb
119
160
  - lib/action_mailer/inline_preview_interceptor.rb
120
161
  - lib/action_mailer/log_subscriber.rb
121
162
  - lib/action_mailer/mail_delivery_job.rb
122
163
  - lib/action_mailer/mail_helper.rb
123
- - lib/action_mailer/mail_with_error_handling.rb
124
164
  - lib/action_mailer/message_delivery.rb
125
165
  - lib/action_mailer/parameterized.rb
126
166
  - lib/action_mailer/preview.rb
@@ -138,10 +178,10 @@ licenses:
138
178
  - MIT
139
179
  metadata:
140
180
  bug_tracker_uri: https://github.com/rails/rails/issues
141
- changelog_uri: https://github.com/rails/rails/blob/v6.1.7.3/actionmailer/CHANGELOG.md
142
- documentation_uri: https://api.rubyonrails.org/v6.1.7.3/
181
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.3/actionmailer/CHANGELOG.md
182
+ documentation_uri: https://api.rubyonrails.org/v7.0.3/
143
183
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
144
- source_code_uri: https://github.com/rails/rails/tree/v6.1.7.3/actionmailer
184
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.3/actionmailer
145
185
  rubygems_mfa_required: 'true'
146
186
  post_install_message:
147
187
  rdoc_options: []
@@ -151,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
191
  requirements:
152
192
  - - ">="
153
193
  - !ruby/object:Gem::Version
154
- version: 2.5.0
194
+ version: 2.7.0
155
195
  required_rubygems_version: !ruby/object:Gem::Requirement
156
196
  requirements:
157
197
  - - ">="
@@ -159,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
199
  version: '0'
160
200
  requirements:
161
201
  - none
162
- rubygems_version: 3.4.3
202
+ rubygems_version: 3.3.7
163
203
  signing_key:
164
204
  specification_version: 4
165
205
  summary: Email composition and delivery framework (part of Rails).
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_job"
4
-
5
- module ActionMailer
6
- # The <tt>ActionMailer::DeliveryJob</tt> class is used when you
7
- # want to send emails outside of the request-response cycle.
8
- #
9
- # Exceptions are rescued and handled by the mailer class.
10
- class DeliveryJob < ActiveJob::Base # :nodoc:
11
- queue_as { ActionMailer::Base.deliver_later_queue_name }
12
-
13
- rescue_from StandardError, with: :handle_exception_with_mailer_class
14
-
15
- before_perform do
16
- ActiveSupport::Deprecation.warn <<~MSG.squish
17
- Sending mail with DeliveryJob and Parameterized::DeliveryJob
18
- is deprecated and will be removed in Rails 7.0.
19
- Please use MailDeliveryJob instead.
20
- MSG
21
- end
22
-
23
- def perform(mailer, mail_method, delivery_method, *args) #:nodoc:
24
- mailer.constantize.public_send(mail_method, *args).send(delivery_method)
25
- end
26
- ruby2_keywords(:perform) if respond_to?(:ruby2_keywords, true)
27
-
28
- private
29
- # "Deserialize" the mailer class name by hand in case another argument
30
- # (like a Global ID reference) raised DeserializationError.
31
- def mailer_class
32
- if mailer = Array(@serialized_arguments).first || Array(arguments).first
33
- mailer.constantize
34
- end
35
- end
36
-
37
- def handle_exception_with_mailer_class(exception)
38
- if klass = mailer_class
39
- klass.handle_exception exception
40
- else
41
- raise exception
42
- end
43
- end
44
- end
45
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- begin
4
- require "mail"
5
- rescue LoadError => error
6
- if error.message.match?(/net\/smtp/)
7
- $stderr.puts "You don't have net-smtp installed in your application. Please add it to your Gemfile and run bundle install"
8
- raise
9
- end
10
- end