actionmailer 6.0.6.1 → 6.1.7.6

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: 29c980d88d2f291c80157bbfc789b99151edd49c3b837069a44c4351415a0ba7
4
- data.tar.gz: 23481d7eace9aa5f410a7e11508a8634f3c9dbdbb557a1bf2c8db5c237be4367
3
+ metadata.gz: 108f3c55ba55b639ad73688d53b9171c521de8f40dcad016babd5602b765743c
4
+ data.tar.gz: 3cb3c5659972171a6acc740ded03c04d949ede59a99e54e9bc37ae94db0106a2
5
5
  SHA512:
6
- metadata.gz: 89a916c2a203b14f0e05c1459670923550d820328e565b93bfd439c1f06db04726bf44eab484f6fceb5812b84ddd58cfb15ca08d088f0b40ae29b3405c9764c7
7
- data.tar.gz: bf14baba84d405e761b33a3e42768c82981e64703b68e9037048f23ee1a2d5e978f146260ac697331c85bd28b88da80a4066a30e6e5193713aad621915beacb1
6
+ metadata.gz: 48d5ea4f1da22db3495b016ad056ab9f999b2badf04d4aa559b5028fd3ac529630831396c2c04a8acad4b211d4b865b0c0fa1f891c5ec8356310dc37b591804a
7
+ data.tar.gz: 22852825a97032541031e648936abff15db25b578a81746b6979f78db918e2a4ce3589d724d4f6baaf8f6639ffe25b631a56d7c29128b6bba7e8a5db3d7cf339
data/CHANGELOG.md CHANGED
@@ -1,223 +1,148 @@
1
- ## Rails 6.0.6.1 (January 17, 2023) ##
1
+ ## Rails 6.1.7.6 (August 22, 2023) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 6.0.6 (September 09, 2022) ##
6
+ ## Rails 6.1.7.5 (August 22, 2023) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 6.0.5.1 (July 12, 2022) ##
11
+ ## Rails 6.1.7.4 (June 26, 2023) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 6.0.5 (May 09, 2022) ##
16
+ ## Rails 6.1.7.3 (March 13, 2023) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 6.0.4.8 (April 26, 2022) ##
21
+ ## Rails 6.1.7.2 (January 24, 2023) ##
22
22
 
23
23
  * No changes.
24
24
 
25
25
 
26
- ## Rails 6.0.4.7 (March 08, 2022) ##
26
+ ## Rails 6.1.7.1 (January 17, 2023) ##
27
27
 
28
28
  * No changes.
29
29
 
30
30
 
31
- ## Rails 6.0.4.6 (February 11, 2022) ##
31
+ ## Rails 6.1.7 (September 09, 2022) ##
32
32
 
33
33
  * No changes.
34
34
 
35
35
 
36
- ## Rails 6.0.4.5 (February 11, 2022) ##
36
+ ## Rails 6.1.6.1 (July 12, 2022) ##
37
37
 
38
38
  * No changes.
39
39
 
40
40
 
41
- ## Rails 6.0.4.4 (December 15, 2021) ##
41
+ ## Rails 6.1.6 (May 09, 2022) ##
42
42
 
43
43
  * No changes.
44
44
 
45
45
 
46
- ## Rails 6.0.4.3 (December 14, 2021) ##
46
+ ## Rails 6.1.5.1 (April 26, 2022) ##
47
47
 
48
48
  * No changes.
49
49
 
50
50
 
51
- ## Rails 6.0.4.2 (December 14, 2021) ##
51
+ ## Rails 6.1.5 (March 09, 2022) ##
52
52
 
53
53
  * No changes.
54
54
 
55
55
 
56
- ## Rails 6.0.4.1 (August 19, 2021) ##
56
+ ## Rails 6.1.4.7 (March 08, 2022) ##
57
57
 
58
58
  * No changes.
59
59
 
60
60
 
61
- ## Rails 6.0.4 (June 15, 2021) ##
61
+ ## Rails 6.1.4.6 (February 11, 2022) ##
62
62
 
63
63
  * No changes.
64
64
 
65
65
 
66
- ## Rails 6.0.3.7 (May 05, 2021) ##
66
+ ## Rails 6.1.4.5 (February 11, 2022) ##
67
67
 
68
68
  * No changes.
69
69
 
70
70
 
71
- ## Rails 6.0.3.6 (March 26, 2021) ##
71
+ ## Rails 6.1.4.4 (December 15, 2021) ##
72
72
 
73
73
  * No changes.
74
74
 
75
75
 
76
- ## Rails 6.0.3.5 (February 10, 2021) ##
76
+ ## Rails 6.1.4.3 (December 14, 2021) ##
77
77
 
78
78
  * No changes.
79
79
 
80
80
 
81
- ## Rails 6.0.3.4 (October 07, 2020) ##
81
+ ## Rails 6.1.4.2 (December 14, 2021) ##
82
82
 
83
83
  * No changes.
84
84
 
85
85
 
86
- ## Rails 6.0.3.3 (September 09, 2020) ##
86
+ ## Rails 6.1.4.1 (August 19, 2021) ##
87
87
 
88
88
  * No changes.
89
89
 
90
90
 
91
- ## Rails 6.0.3.2 (June 17, 2020) ##
91
+ ## Rails 6.1.4 (June 24, 2021) ##
92
92
 
93
93
  * No changes.
94
94
 
95
95
 
96
- ## Rails 6.0.3.1 (May 18, 2020) ##
96
+ ## Rails 6.1.3.2 (May 05, 2021) ##
97
97
 
98
98
  * No changes.
99
99
 
100
100
 
101
- ## Rails 6.0.3 (May 06, 2020) ##
101
+ ## Rails 6.1.3.1 (March 26, 2021) ##
102
102
 
103
103
  * No changes.
104
104
 
105
105
 
106
- ## Rails 6.0.2.2 (March 19, 2020) ##
106
+ ## Rails 6.1.3 (February 17, 2021) ##
107
107
 
108
108
  * No changes.
109
109
 
110
110
 
111
- ## Rails 6.0.2.1 (December 18, 2019) ##
111
+ ## Rails 6.1.2.1 (February 10, 2021) ##
112
112
 
113
113
  * No changes.
114
114
 
115
115
 
116
- ## Rails 6.0.2 (December 13, 2019) ##
117
-
118
- * Fix ActionMailer assertions don't work for parameterized mail with legacy delivery job.
119
-
120
- *bogdanvlviv*
121
-
122
-
123
- ## Rails 6.0.1 (November 5, 2019) ##
116
+ ## Rails 6.1.2 (February 09, 2021) ##
124
117
 
125
118
  * No changes.
126
119
 
127
120
 
128
- ## Rails 6.0.0 (August 16, 2019) ##
121
+ ## Rails 6.1.1 (January 07, 2021) ##
129
122
 
130
- * No changes.
131
-
132
-
133
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
134
-
135
- * No changes.
123
+ * Sets default mailer queue to `"default"` in the mail assertions.
136
124
 
125
+ *Paul Keen*
137
126
 
138
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
139
-
140
- * No changes.
141
-
142
-
143
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
144
-
145
- * No changes.
146
-
147
-
148
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
149
-
150
- * No changes.
151
127
 
128
+ ## Rails 6.1.0 (December 09, 2020) ##
152
129
 
153
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
130
+ * Change default queue name of the deliver (`:mailers`) job to be the job adapter's
131
+ default (`:default`).
154
132
 
155
- * Deprecate `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
133
+ *Rafael Mendonça França*
156
134
 
157
- *George Claghorn*
135
+ * Remove deprecated `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
158
136
 
159
- * Add `MailDeliveryJob` for delivering both regular and parameterized mail. Deprecate using `DeliveryJob` and `Parameterized::DeliveryJob`.
137
+ *Rafael Mendonça França*
160
138
 
161
- *Gannon McGibbon*
162
-
163
- * Fix ActionMailer assertions not working when a Mail defines
164
- a custom delivery job class
165
-
166
- *Edouard Chin*
167
-
168
- * Mails with multipart `format` blocks with implicit render now also check for
169
- a template name in options hash instead of only using the action name.
170
-
171
- *Marcus Ilgner*
172
-
173
- * `ActionDispatch::IntegrationTest` includes `ActionMailer::TestHelper` module by default.
174
-
175
- *Ricardo Díaz*
176
-
177
- * Add `perform_deliveries` to a payload of `deliver.action_mailer` notification.
178
-
179
- *Yoshiyuki Kinjo*
180
-
181
- * Change delivery logging message when `perform_deliveries` is false.
182
-
183
- *Yoshiyuki Kinjo*
184
-
185
- * Allow call `assert_enqueued_email_with` with no block.
186
-
187
- Example:
188
- ```
189
- def test_email
190
- ContactMailer.welcome.deliver_later
191
- assert_enqueued_email_with ContactMailer, :welcome
192
- end
193
-
194
- def test_email_with_arguments
195
- ContactMailer.welcome("Hello", "Goodbye").deliver_later
196
- assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
197
- end
198
- ```
139
+ * Fix ActionMailer assertions don't work for parameterized mail with legacy delivery job.
199
140
 
200
141
  *bogdanvlviv*
201
142
 
202
- * Ensure mail gem is eager autoloaded when eager load is true to prevent thread deadlocks.
203
-
204
- *Samuel Cochran*
205
-
206
- * Perform email jobs in `assert_emails`.
207
-
208
- *Gannon McGibbon*
209
-
210
- * Add `Base.unregister_observer`, `Base.unregister_observers`,
211
- `Base.unregister_interceptor`, `Base.unregister_interceptors`,
212
- `Base.unregister_preview_interceptor` and `Base.unregister_preview_interceptors`.
213
- This makes it possible to dynamically add and remove email observers and
214
- interceptors at runtime in the same way they're registered.
215
-
216
- *Claudio Ortolina*, *Kota Miyake*
217
-
218
- * Rails 6 requires Ruby 2.5.0 or newer.
143
+ * Added `email_address_with_name` to properly escape addresses with names.
219
144
 
220
- *Jeremy Daer*, *Kasper Timm Hansen*
145
+ *Sunny Ripert*
221
146
 
222
147
 
223
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actionmailer/CHANGELOG.md) for previous changes.
148
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionmailer/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2019 David Heinemeier Hansson
1
+ Copyright (c) 2004-2022 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
@@ -18,4 +18,3 @@ 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 "mail"
3
+ require "action_mailer/mail_with_error_handling"
4
4
  require "action_mailer/collector"
5
5
  require "active_support/core_ext/string/inflections"
6
6
  require "active_support/core_ext/hash/except"
@@ -16,11 +16,11 @@ module ActionMailer
16
16
  #
17
17
  # To use Action Mailer, you need to create a mailer model.
18
18
  #
19
- # $ rails generate mailer Notifier
19
+ # $ bin/rails generate mailer Notifier
20
20
  #
21
21
  # The generated model inherits from <tt>ApplicationMailer</tt> which in turn
22
22
  # inherits from <tt>ActionMailer::Base</tt>. A mailer model defines methods
23
- # used to generate an email message. In these methods, you can setup variables to be used in
23
+ # used to generate an email message. In these methods, you can set up variables to be used in
24
24
  # the mailer views, options on the mail itself such as the <tt>:from</tt> address, and attachments.
25
25
  #
26
26
  # class ApplicationMailer < ActionMailer::Base
@@ -455,10 +455,6 @@ module ActionMailer
455
455
 
456
456
  PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [:@_action_has_layout]
457
457
 
458
- def _protected_ivars # :nodoc:
459
- PROTECTED_IVARS
460
- end
461
-
462
458
  helper ActionMailer::MailHelper
463
459
 
464
460
  class_attribute :delivery_job, default: ::ActionMailer::DeliveryJob
@@ -551,32 +547,6 @@ module ActionMailer
551
547
  # config.action_mailer.default_options = { from: "no-reply@example.org" }
552
548
  alias :default_options= :default
553
549
 
554
- # Receives a raw email, parses it into an email object, decodes it,
555
- # instantiates a new mailer, and passes the email object to the mailer
556
- # object's +receive+ method.
557
- #
558
- # If you want your mailer to be able to process incoming messages, you'll
559
- # need to implement a +receive+ method that accepts the raw email string
560
- # as a parameter:
561
- #
562
- # class MyMailer < ActionMailer::Base
563
- # def receive(mail)
564
- # # ...
565
- # end
566
- # end
567
- def receive(raw_mail)
568
- ActiveSupport::Deprecation.warn(<<~MESSAGE.squish)
569
- ActionMailer::Base.receive is deprecated and will be removed in Rails 6.1.
570
- Use Action Mailbox to process inbound email.
571
- MESSAGE
572
-
573
- ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
574
- mail = Mail.new(raw_mail)
575
- set_payload_for_mail(payload, mail)
576
- new.receive(mail)
577
- end
578
- end
579
-
580
550
  # Wraps an email delivery inside of <tt>ActiveSupport::Notifications</tt> instrumentation.
581
551
  #
582
552
  # This method is actually called by the <tt>Mail::Message</tt> object itself
@@ -590,6 +560,14 @@ module ActionMailer
590
560
  end
591
561
  end
592
562
 
563
+ # Returns an email in the format "Name <email@example.com>".
564
+ def email_address_with_name(address, name)
565
+ Mail::Address.new.tap do |builder|
566
+ builder.address = address
567
+ builder.display_name = name
568
+ end.to_s
569
+ end
570
+
593
571
  private
594
572
  def set_payload_for_mail(payload, mail)
595
573
  payload[:mail] = mail.encoded
@@ -657,6 +635,11 @@ module ActionMailer
657
635
  self.class.mailer_name
658
636
  end
659
637
 
638
+ # Returns an email in the format "Name <email@example.com>".
639
+ def email_address_with_name(address, name)
640
+ self.class.email_address_with_name(address, name)
641
+ end
642
+
660
643
  # Allows you to pass random and unusual headers to the new <tt>Mail::Message</tt>
661
644
  # object which will add them to itself.
662
645
  #
@@ -738,7 +721,7 @@ module ActionMailer
738
721
  end
739
722
 
740
723
  class LateAttachmentsProxy < SimpleDelegator
741
- def inline; _raise_error end
724
+ def inline; self end
742
725
  def []=(_name, _content); _raise_error end
743
726
 
744
727
  private
@@ -859,8 +842,9 @@ module ActionMailer
859
842
  @_mail_was_called = true
860
843
 
861
844
  create_parts_from_responses(message, responses)
845
+ wrap_inline_attachments(message)
862
846
 
863
- # Setup content type, reapply charset and handle parts order
847
+ # Set up content type, reapply charset and handle parts order
864
848
  message.content_type = set_content_type(message, content_type, headers[:content_type])
865
849
  message.charset = charset
866
850
 
@@ -888,7 +872,7 @@ module ActionMailer
888
872
  when user_content_type.present?
889
873
  user_content_type
890
874
  when m.has_attachments?
891
- if m.attachments.detect(&:inline?)
875
+ if m.attachments.all?(&:inline?)
892
876
  ["multipart", "related", params]
893
877
  else
894
878
  ["multipart", "mixed", params]
@@ -915,12 +899,9 @@ module ActionMailer
915
899
  end
916
900
 
917
901
  def apply_defaults(headers)
918
- default_values = self.class.default.map do |key, value|
919
- [
920
- key,
921
- compute_default(value)
922
- ]
923
- end.to_h
902
+ default_values = self.class.default.transform_values do |value|
903
+ compute_default(value)
904
+ end
924
905
 
925
906
  headers_with_defaults = headers.reverse_merge(default_values)
926
907
  headers_with_defaults[:subject] ||= default_i18n_subject
@@ -989,6 +970,27 @@ module ActionMailer
989
970
  end
990
971
  end
991
972
 
973
+ def wrap_inline_attachments(message)
974
+ # If we have both types of attachment, wrap all the inline attachments
975
+ # in multipart/related, but not the actual attachments
976
+ if message.attachments.detect(&:inline?) && message.attachments.detect { |a| !a.inline? }
977
+ related = Mail::Part.new
978
+ related.content_type = "multipart/related"
979
+ mixed = [ related ]
980
+
981
+ message.parts.each do |p|
982
+ if p.attachment? && !p.inline?
983
+ mixed << p
984
+ else
985
+ related.add_part(p)
986
+ end
987
+ end
988
+
989
+ message.parts.clear
990
+ mixed.each { |c| message.add_part(c) }
991
+ end
992
+ end
993
+
992
994
  def create_parts_from_responses(m, responses)
993
995
  if responses.size == 1 && !m.has_attachments?
994
996
  responses[0].each { |k, v| m[k] = v }
@@ -1020,6 +1022,10 @@ module ActionMailer
1020
1022
  "action_mailer"
1021
1023
  end
1022
1024
 
1025
+ def _protected_ivars
1026
+ PROTECTED_IVARS
1027
+ end
1028
+
1023
1029
  ActiveSupport.run_load_hooks(:action_mailer, self)
1024
1030
  end
1025
1031
  end
@@ -15,7 +15,7 @@ module ActionMailer
15
15
  before_perform do
16
16
  ActiveSupport::Deprecation.warn <<~MSG.squish
17
17
  Sending mail with DeliveryJob and Parameterized::DeliveryJob
18
- is deprecated and will be removed in Rails 6.1.
18
+ is deprecated and will be removed in Rails 7.0.
19
19
  Please use MailDeliveryJob instead.
20
20
  MSG
21
21
  end
@@ -49,7 +49,7 @@ module ActionMailer
49
49
  # arguments: '-i'
50
50
  def add_delivery_method(symbol, klass, default_options = {})
51
51
  class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
52
- send(:"#{symbol}_settings=", default_options)
52
+ public_send(:"#{symbol}_settings=", default_options)
53
53
  self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze
54
54
  end
55
55
 
@@ -8,9 +8,9 @@ module ActionMailer
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 6
11
- MINOR = 0
12
- TINY = 6
13
- PRE = "1"
11
+ MINOR = 1
12
+ TINY = 7
13
+ PRE = "6"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -20,12 +20,6 @@ module ActionMailer
20
20
  debug { event.payload[:mail] }
21
21
  end
22
22
 
23
- # An email was received.
24
- def receive(event)
25
- info { "Received mail (#{event.duration.round(1)}ms)" }
26
- debug { event.payload[:mail] }
27
- end
28
-
29
23
  # An email was generated.
30
24
  def process(event)
31
25
  debug do
@@ -0,0 +1,10 @@
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
@@ -53,12 +53,14 @@ module ActionMailer
53
53
  # Notifier.welcome(User.first).deliver_later!
54
54
  # Notifier.welcome(User.first).deliver_later!(wait: 1.hour)
55
55
  # Notifier.welcome(User.first).deliver_later!(wait_until: 10.hours.from_now)
56
+ # Notifier.welcome(User.first).deliver_later!(priority: 10)
56
57
  #
57
58
  # Options:
58
59
  #
59
60
  # * <tt>:wait</tt> - Enqueue the email to be delivered with a delay
60
61
  # * <tt>:wait_until</tt> - Enqueue the email to be delivered at (after) a specific date / time
61
62
  # * <tt>:queue</tt> - Enqueue the email on the specified queue
63
+ # * <tt>:priority</tt> - Enqueues the email with the specified priority
62
64
  #
63
65
  # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
64
66
  # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
@@ -77,12 +79,14 @@ module ActionMailer
77
79
  # Notifier.welcome(User.first).deliver_later
78
80
  # Notifier.welcome(User.first).deliver_later(wait: 1.hour)
79
81
  # Notifier.welcome(User.first).deliver_later(wait_until: 10.hours.from_now)
82
+ # Notifier.welcome(User.first).deliver_later(priority: 10)
80
83
  #
81
84
  # Options:
82
85
  #
83
86
  # * <tt>:wait</tt> - Enqueue the email to be delivered with a delay.
84
87
  # * <tt>:wait_until</tt> - Enqueue the email to be delivered at (after) a specific date / time.
85
88
  # * <tt>:queue</tt> - Enqueue the email on the specified queue.
89
+ # * <tt>:priority</tt> - Enqueues the email with the specified priority
86
90
  #
87
91
  # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
88
92
  # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
@@ -138,14 +142,37 @@ module ActionMailer
138
142
  else
139
143
  job = @mailer_class.delivery_job
140
144
 
141
- if job <= MailDeliveryJob
145
+ if use_new_args?(job)
142
146
  job.set(options).perform_later(
143
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)
144
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
+
145
162
  job.set(options).perform_later(
146
163
  @mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
147
164
  end
148
165
  end
149
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 != :**
175
+ end
176
+ end
150
177
  end
151
178
  end
@@ -114,7 +114,7 @@ module ActionMailer
114
114
 
115
115
  # Returns the underscored name of the mailer preview without the suffix.
116
116
  def preview_name
117
- name.sub(/Preview$/, "").underscore
117
+ name.delete_suffix("Preview").underscore
118
118
  end
119
119
 
120
120
  private
@@ -18,11 +18,6 @@ module ActionMailer
18
18
  paths = app.config.paths
19
19
  options = app.config.action_mailer
20
20
 
21
- if app.config.force_ssl
22
- options.default_url_options ||= {}
23
- options.default_url_options[:protocol] ||= "https"
24
- end
25
-
26
21
  options.assets_dir ||= paths["public"].first
27
22
  options.javascripts_dir ||= paths["public/javascripts"].first
28
23
  options.stylesheets_dir ||= paths["public/stylesheets"].first
@@ -123,13 +123,13 @@ module ActionMailer
123
123
  # ContactMailer.with(email: 'user@example.com').welcome.deliver_later
124
124
  # end
125
125
  # end
126
- def assert_enqueued_email_with(mailer, method, args: nil, queue: "mailers", &block)
126
+ def assert_enqueued_email_with(mailer, method, args: nil, queue: ActionMailer::Base.deliver_later_queue_name || "default", &block)
127
127
  args = if args.is_a?(Hash)
128
128
  [mailer.to_s, method.to_s, "deliver_now", params: args, args: []]
129
129
  else
130
130
  [mailer.to_s, method.to_s, "deliver_now", args: Array(args)]
131
131
  end
132
- assert_enqueued_with(job: mailer.delivery_job, args: args, queue: queue, &block)
132
+ assert_enqueued_with(job: mailer.delivery_job, args: args, queue: queue.to_s, &block)
133
133
  end
134
134
 
135
135
  # Asserts that no emails are enqueued for later delivery.
data/lib/action_mailer.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2019 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2022 David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
@@ -57,7 +57,7 @@ module ActionMailer
57
57
  def self.eager_load!
58
58
  super
59
59
 
60
- require "mail"
60
+ require "action_mailer/mail_with_error_handling"
61
61
  Mail.eager_autoload!
62
62
  end
63
63
  end
@@ -67,4 +67,5 @@ autoload :Mime, "action_dispatch/http/mime_type"
67
67
  ActiveSupport.on_load(:action_view) do
68
68
  ActionView::Base.default_formats ||= Mime::SET.symbols
69
69
  ActionView::Template::Types.delegate_to Mime
70
+ ActionView::LookupContext::DetailsKey.clear
70
71
  end
@@ -1,6 +1,6 @@
1
1
  Description:
2
2
  ============
3
- Stubs out a new mailer and its views. Passes the mailer name, either
3
+ Generates a new mailer and its views. Passes the mailer name, either
4
4
  CamelCased or under_scored, and an optional list of emails as arguments.
5
5
 
6
6
  This generates a mailer class in app/mailers and invokes your template
@@ -8,10 +8,9 @@ Description:
8
8
 
9
9
  Example:
10
10
  ========
11
- rails generate mailer Notifications signup forgot_password invoice
11
+ bin/rails generate mailer Notifications signup forgot_password invoice
12
12
 
13
13
  creates a Notifications mailer class, views, and test:
14
14
  Mailer: app/mailers/notifications_mailer.rb
15
15
  Views: app/views/notifications_mailer/signup.text.erb [...]
16
16
  Test: test/mailers/notifications_mailer_test.rb
17
-
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.6.1
4
+ version: 6.1.7.6
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-01-17 00:00:00.000000000 Z
11
+ date: 2023-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 6.1.7.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 6.1.7.6
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: actionpack
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - '='
18
32
  - !ruby/object:Gem::Version
19
- version: 6.0.6.1
33
+ version: 6.1.7.6
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - '='
25
39
  - !ruby/object:Gem::Version
26
- version: 6.0.6.1
40
+ version: 6.1.7.6
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: actionview
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - '='
32
46
  - !ruby/object:Gem::Version
33
- version: 6.0.6.1
47
+ version: 6.1.7.6
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - '='
39
53
  - !ruby/object:Gem::Version
40
- version: 6.0.6.1
54
+ version: 6.1.7.6
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: activejob
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: 6.0.6.1
61
+ version: 6.1.7.6
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 6.0.6.1
68
+ version: 6.1.7.6
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: mail
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +120,7 @@ files:
106
120
  - lib/action_mailer/log_subscriber.rb
107
121
  - lib/action_mailer/mail_delivery_job.rb
108
122
  - lib/action_mailer/mail_helper.rb
123
+ - lib/action_mailer/mail_with_error_handling.rb
109
124
  - lib/action_mailer/message_delivery.rb
110
125
  - lib/action_mailer/parameterized.rb
111
126
  - lib/action_mailer/preview.rb
@@ -123,10 +138,10 @@ licenses:
123
138
  - MIT
124
139
  metadata:
125
140
  bug_tracker_uri: https://github.com/rails/rails/issues
126
- changelog_uri: https://github.com/rails/rails/blob/v6.0.6.1/actionmailer/CHANGELOG.md
127
- documentation_uri: https://api.rubyonrails.org/v6.0.6.1/
141
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.7.6/actionmailer/CHANGELOG.md
142
+ documentation_uri: https://api.rubyonrails.org/v6.1.7.6/
128
143
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
129
- source_code_uri: https://github.com/rails/rails/tree/v6.0.6.1/actionmailer
144
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.7.6/actionmailer
130
145
  rubygems_mfa_required: 'true'
131
146
  post_install_message:
132
147
  rdoc_options: []
@@ -144,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
159
  version: '0'
145
160
  requirements:
146
161
  - none
147
- rubygems_version: 3.4.3
162
+ rubygems_version: 3.3.3
148
163
  signing_key:
149
164
  specification_version: 4
150
165
  summary: Email composition and delivery framework (part of Rails).