actionmailer 7.1.5.2 → 8.1.2.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 +4 -4
- data/CHANGELOG.md +17 -191
- data/README.rdoc +1 -1
- data/lib/action_mailer/base.rb +9 -14
- data/lib/action_mailer/callbacks.rb +6 -0
- data/lib/action_mailer/delivery_methods.rb +1 -2
- data/lib/action_mailer/form_builder.rb +1 -1
- data/lib/action_mailer/gem_version.rb +3 -3
- data/lib/action_mailer/inline_preview_interceptor.rb +1 -1
- data/lib/action_mailer/log_subscriber.rb +1 -5
- data/lib/action_mailer/message_delivery.rb +34 -0
- data/lib/action_mailer/parameterized.rb +5 -7
- data/lib/action_mailer/preview.rb +0 -24
- data/lib/action_mailer/railtie.rb +1 -7
- data/lib/action_mailer/structured_event_subscriber.rb +38 -0
- data/lib/action_mailer/test_helper.rb +0 -20
- data/lib/rails/generators/mailer/templates/mailer.rb.tt +3 -1
- metadata +17 -64
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a26ac1e2746a8fa65256ee14298bb39e4707593b6a29cbc414c38f3b66e073bb
|
|
4
|
+
data.tar.gz: b551d0a6b3c79a5745b9a3b48746e1caa7720d822f4a0f7d5e960d0abc89346e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 51cf69423be9bad5526eeebb32f5e3691ea2e656be61fa7197c8db60468c60ef8a267ff1a255dd53ee409bd261c1d845328334c00d9755446ac4896b6fc7b13e
|
|
7
|
+
data.tar.gz: 4cd3e3b8a548f38da383370461f8779f68eb093562f5f6b17afdeb81cac9c4d4cf4bfe00960f4a05e39943a0b5b30b6986a8f7de65626c29f2b96d2fe1a1aefc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,214 +1,40 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.1.2.1 (March 23, 2026) ##
|
|
2
2
|
|
|
3
3
|
* No changes.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
## Rails
|
|
6
|
+
## Rails 8.1.2 (January 08, 2026) ##
|
|
7
7
|
|
|
8
8
|
* No changes.
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
## Rails
|
|
11
|
+
## Rails 8.1.1 (October 28, 2025) ##
|
|
12
12
|
|
|
13
13
|
* No changes.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
## Rails
|
|
16
|
+
## Rails 8.1.0 (October 22, 2025) ##
|
|
17
17
|
|
|
18
|
-
*
|
|
18
|
+
* Add structured events for Action Mailer:
|
|
19
|
+
- `action_mailer.delivered`
|
|
20
|
+
- `action_mailer.processed`
|
|
19
21
|
|
|
20
|
-
*
|
|
22
|
+
*Gannon McGibbon*
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
## Rails 7.1.4.1 (October 15, 2024) ##
|
|
24
|
-
|
|
25
|
-
* Avoid regex backtracking in `block_format` helper
|
|
26
|
-
|
|
27
|
-
[CVE-2024-47889]
|
|
28
|
-
|
|
29
|
-
*John Hawthorn*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Rails 7.1.4 (August 22, 2024) ##
|
|
33
|
-
|
|
34
|
-
* No changes.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Rails 7.1.3.4 (June 04, 2024) ##
|
|
38
|
-
|
|
39
|
-
* No changes.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Rails 7.1.3.3 (May 16, 2024) ##
|
|
43
|
-
|
|
44
|
-
* No changes.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Rails 7.1.3.2 (February 21, 2024) ##
|
|
48
|
-
|
|
49
|
-
* No changes.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Rails 7.1.3.1 (February 21, 2024) ##
|
|
53
|
-
|
|
54
|
-
* No changes.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Rails 7.1.3 (January 16, 2024) ##
|
|
58
|
-
|
|
59
|
-
* No changes.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Rails 7.1.2 (November 10, 2023) ##
|
|
63
|
-
|
|
64
|
-
* No changes.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Rails 7.1.1 (October 11, 2023) ##
|
|
68
|
-
|
|
69
|
-
* No changes.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
## Rails 7.1.0 (October 05, 2023) ##
|
|
73
|
-
|
|
74
|
-
* No changes.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
|
78
|
-
|
|
79
|
-
* No changes.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
|
83
|
-
|
|
84
|
-
* Introduce `ActionMailer::FormBuilder`
|
|
85
|
-
|
|
86
|
-
Use the `default_form_builder` method in mailers to set the default form builder
|
|
87
|
-
for templates rendered by that mailer. Matches the behaviour in Action Controller.
|
|
88
|
-
|
|
89
|
-
*Alex Ghiculescu*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
|
93
|
-
|
|
94
|
-
* Mailers are listed in alphabetical order on the mailer preview page now.
|
|
95
|
-
|
|
96
|
-
*Martin Spickermann*
|
|
97
|
-
|
|
98
|
-
* Deprecate passing params to `assert_enqueued_email_with` via the `:args`
|
|
99
|
-
kwarg. `assert_enqueued_email_with` now supports a `:params` kwarg, so use
|
|
100
|
-
that to pass params:
|
|
101
|
-
|
|
102
|
-
```ruby
|
|
103
|
-
# BEFORE
|
|
104
|
-
assert_enqueued_email_with MyMailer, :my_method, args: { my_param: "value" }
|
|
105
|
-
|
|
106
|
-
# AFTER
|
|
107
|
-
assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" }
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
To specify named mailer args as a Hash, wrap the Hash in an array:
|
|
111
|
-
|
|
112
|
-
```ruby
|
|
113
|
-
assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }]
|
|
114
|
-
# OR
|
|
115
|
-
assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
*Jonathan Hefner*
|
|
119
|
-
|
|
120
|
-
* Accept procs for args and params in `assert_enqueued_email_with`
|
|
121
|
-
|
|
122
|
-
```ruby
|
|
123
|
-
assert_enqueued_email_with DeliveryJob, params: -> p { p[:token] =~ /\w+/ } do
|
|
124
|
-
UserMailer.with(token: user.generate_token).email_verification.deliver_later
|
|
125
|
-
end
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
*Max Chernyak*
|
|
129
|
-
|
|
130
|
-
* Added `*_deliver` callbacks to `ActionMailer::Base` that wrap mail message delivery.
|
|
131
|
-
|
|
132
|
-
Example:
|
|
133
|
-
|
|
134
|
-
```ruby
|
|
135
|
-
class EventsMailer < ApplicationMailer
|
|
136
|
-
after_deliver do
|
|
137
|
-
User.find_by(email: message.to.first).update(email_provider_id: message.message_id, emailed_at: Time.current)
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
*Ben Sheldon*
|
|
143
|
-
|
|
144
|
-
* Added `deliver_enqueued_emails` to `ActionMailer::TestHelper`. This method
|
|
145
|
-
delivers all enqueued email jobs.
|
|
146
|
-
|
|
147
|
-
Example:
|
|
148
|
-
|
|
149
|
-
```ruby
|
|
150
|
-
def test_deliver_enqueued_emails
|
|
151
|
-
deliver_enqueued_emails do
|
|
152
|
-
ContactMailer.welcome.deliver_later
|
|
153
|
-
end
|
|
154
|
-
assert_emails 1
|
|
155
|
-
end
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
*Andrew Novoselac*
|
|
159
|
-
|
|
160
|
-
* The `deliver_later_queue_name` used by the default mailer job can now be
|
|
161
|
-
configured on a per-mailer basis. Previously this was only configurable
|
|
162
|
-
for all mailers via `ActionMailer::Base`.
|
|
163
|
-
|
|
164
|
-
Example:
|
|
24
|
+
* Add `deliver_all_later` to enqueue multiple emails at once.
|
|
165
25
|
|
|
166
26
|
```ruby
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
end
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
*Jeffrey Hardy*
|
|
27
|
+
user_emails = User.all.map { |user| Notifier.welcome(user) }
|
|
28
|
+
ActionMailer.deliver_all_later(user_emails)
|
|
173
29
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
Headers like `Message-ID` for threading or email service provider specific
|
|
177
|
-
features like analytics tags or account metadata can now be viewed directly
|
|
178
|
-
in the mailer preview.
|
|
179
|
-
|
|
180
|
-
*Matt Swanson*
|
|
181
|
-
|
|
182
|
-
* Default `ActionMailer::Parameterized#params` to an empty `Hash`
|
|
183
|
-
|
|
184
|
-
*Sean Doyle*
|
|
185
|
-
|
|
186
|
-
* Introduce the `capture_emails` test helper.
|
|
187
|
-
|
|
188
|
-
Returns all emails that are sent in a block.
|
|
189
|
-
|
|
190
|
-
```ruby
|
|
191
|
-
def test_emails
|
|
192
|
-
emails = capture_emails do
|
|
193
|
-
ContactMailer.welcome.deliver_now
|
|
194
|
-
ContactMailer.welcome.deliver_later
|
|
195
|
-
end
|
|
196
|
-
assert_email "Hi there", emails.first.subject
|
|
197
|
-
end
|
|
30
|
+
# use a custom queue
|
|
31
|
+
ActionMailer.deliver_all_later(user_emails, queue: :my_queue)
|
|
198
32
|
```
|
|
199
33
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*Igor Kasyanchuk*
|
|
205
|
-
|
|
206
|
-
* Support multiple preview paths for mailers.
|
|
207
|
-
|
|
208
|
-
Option `config.action_mailer.preview_path` is deprecated in favor of
|
|
209
|
-
`config.action_mailer.preview_paths`. Appending paths to this configuration option
|
|
210
|
-
will cause those paths to be used in the search for mailer previews.
|
|
34
|
+
This can greatly reduce the number of round-trips to the queue datastore.
|
|
35
|
+
For queue adapters that do not implement the `enqueue_all` method, we
|
|
36
|
+
fall back to enqueuing email jobs indvidually.
|
|
211
37
|
|
|
212
38
|
*fatkodima*
|
|
213
39
|
|
|
214
|
-
Please check [
|
|
40
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionmailer/CHANGELOG.md) for previous changes.
|
data/README.rdoc
CHANGED
|
@@ -136,6 +136,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
|
|
|
136
136
|
|
|
137
137
|
* https://github.com/rails/rails/issues
|
|
138
138
|
|
|
139
|
-
Feature requests should be discussed on the
|
|
139
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
140
140
|
|
|
141
141
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
data/lib/action_mailer/base.rb
CHANGED
|
@@ -7,6 +7,7 @@ require "active_support/core_ext/hash/except"
|
|
|
7
7
|
require "active_support/core_ext/module/anonymous"
|
|
8
8
|
|
|
9
9
|
require "action_mailer/log_subscriber"
|
|
10
|
+
require "action_mailer/structured_event_subscriber"
|
|
10
11
|
require "action_mailer/rescuable"
|
|
11
12
|
|
|
12
13
|
module ActionMailer
|
|
@@ -574,18 +575,13 @@ module ActionMailer
|
|
|
574
575
|
attr_writer :mailer_name
|
|
575
576
|
alias :controller_path :mailer_name
|
|
576
577
|
|
|
577
|
-
#
|
|
578
|
-
#
|
|
579
|
-
# config.action_mailer.default(from: "no-reply@example.org")
|
|
578
|
+
# Allows to set defaults through app configuration:
|
|
580
579
|
#
|
|
581
|
-
#
|
|
580
|
+
# config.action_mailer.default_options = { from: "no-reply@example.org" }
|
|
582
581
|
def default(value = nil)
|
|
583
582
|
self.default_params = default_params.merge(value).freeze if value
|
|
584
583
|
default_params
|
|
585
584
|
end
|
|
586
|
-
# Allows to set defaults through app configuration:
|
|
587
|
-
#
|
|
588
|
-
# config.action_mailer.default_options = { from: "no-reply@example.org" }
|
|
589
585
|
alias :default_options= :default
|
|
590
586
|
|
|
591
587
|
# Wraps an email delivery inside of ActiveSupport::Notifications instrumentation.
|
|
@@ -625,17 +621,16 @@ module ActionMailer
|
|
|
625
621
|
payload[:perform_deliveries] = mail.perform_deliveries
|
|
626
622
|
end
|
|
627
623
|
|
|
628
|
-
def method_missing(method_name,
|
|
629
|
-
if action_methods.include?(method_name.
|
|
630
|
-
MessageDelivery.new(self, method_name,
|
|
624
|
+
def method_missing(method_name, ...)
|
|
625
|
+
if action_methods.include?(method_name.name)
|
|
626
|
+
MessageDelivery.new(self, method_name, ...)
|
|
631
627
|
else
|
|
632
628
|
super
|
|
633
629
|
end
|
|
634
630
|
end
|
|
635
|
-
ruby2_keywords(:method_missing)
|
|
636
631
|
|
|
637
632
|
def respond_to_missing?(method, include_all = false)
|
|
638
|
-
action_methods.include?(method.
|
|
633
|
+
action_methods.include?(method.name) || super
|
|
639
634
|
end
|
|
640
635
|
end
|
|
641
636
|
|
|
@@ -669,7 +664,7 @@ module ActionMailer
|
|
|
669
664
|
true
|
|
670
665
|
end
|
|
671
666
|
|
|
672
|
-
def method_missing(
|
|
667
|
+
def method_missing(...)
|
|
673
668
|
nil
|
|
674
669
|
end
|
|
675
670
|
end
|
|
@@ -936,7 +931,7 @@ module ActionMailer
|
|
|
936
931
|
# If the subject has interpolations, you can pass them through the +interpolations+ parameter.
|
|
937
932
|
def default_i18n_subject(interpolations = {}) # :doc:
|
|
938
933
|
mailer_scope = self.class.mailer_name.tr("/", ".")
|
|
939
|
-
I18n.t(:subject, **interpolations
|
|
934
|
+
I18n.t(:subject, **interpolations, scope: [mailer_scope, action_name], default: action_name.humanize)
|
|
940
935
|
end
|
|
941
936
|
|
|
942
937
|
# Emails do not support relative path links.
|
|
@@ -4,6 +4,8 @@ module ActionMailer
|
|
|
4
4
|
module Callbacks
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
|
|
7
|
+
DEFAULT_INTERNAL_METHODS = [:_run_deliver_callbacks].freeze # :nodoc:
|
|
8
|
+
|
|
7
9
|
included do
|
|
8
10
|
include ActiveSupport::Callbacks
|
|
9
11
|
define_callbacks :deliver, skip_after_callbacks_if_terminated: true
|
|
@@ -26,6 +28,10 @@ module ActionMailer
|
|
|
26
28
|
def around_deliver(*filters, &blk)
|
|
27
29
|
set_callback(:deliver, :around, *filters, &blk)
|
|
28
30
|
end
|
|
31
|
+
|
|
32
|
+
def internal_methods # :nodoc:
|
|
33
|
+
super.concat(DEFAULT_INTERNAL_METHODS)
|
|
34
|
+
end
|
|
29
35
|
end
|
|
30
36
|
end
|
|
31
37
|
end
|
|
@@ -32,8 +32,7 @@ module ActionMailer
|
|
|
32
32
|
|
|
33
33
|
add_delivery_method :sendmail, Mail::Sendmail,
|
|
34
34
|
location: "/usr/sbin/sendmail",
|
|
35
|
-
|
|
36
|
-
arguments: Gem::Version.new(Mail::VERSION.version) >= Gem::Version.new("2.8.0") ? %w[-i] : "-i"
|
|
35
|
+
arguments: %w[-i]
|
|
37
36
|
|
|
38
37
|
add_delivery_method :test, Mail::TestMailer
|
|
39
38
|
end
|
|
@@ -23,7 +23,7 @@ module ActionMailer
|
|
|
23
23
|
# in the views rendered by this mailer and its subclasses.
|
|
24
24
|
#
|
|
25
25
|
# ==== Parameters
|
|
26
|
-
# * <tt>builder</tt> - Default form builder
|
|
26
|
+
# * <tt>builder</tt> - Default form builder. Accepts a subclass of ActionView::Helpers::FormBuilder
|
|
27
27
|
def default_form_builder(builder)
|
|
28
28
|
self._default_form_builder = builder
|
|
29
29
|
end
|
|
@@ -6,7 +6,7 @@ module ActionMailer
|
|
|
6
6
|
# = Action Mailer \InlinePreviewInterceptor
|
|
7
7
|
#
|
|
8
8
|
# Implements a mailer preview interceptor that converts image tag src attributes
|
|
9
|
-
# that use inline cid
|
|
9
|
+
# that use inline +cid:+ style URLs to +data:+ style URLs so that they are visible
|
|
10
10
|
# when previewing an HTML email in a web browser.
|
|
11
11
|
#
|
|
12
12
|
# This interceptor is enabled by default. To disable it, delete it from the
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
require "active_support/log_subscriber"
|
|
4
4
|
|
|
5
5
|
module ActionMailer
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
# Implements the ActiveSupport::LogSubscriber for logging notifications when
|
|
9
|
-
# email is delivered or received.
|
|
10
|
-
class LogSubscriber < ActiveSupport::LogSubscriber
|
|
6
|
+
class LogSubscriber < ActiveSupport::LogSubscriber # :nodoc:
|
|
11
7
|
# An email was delivered.
|
|
12
8
|
def deliver(event)
|
|
13
9
|
info do
|
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
require "delegate"
|
|
4
4
|
|
|
5
5
|
module ActionMailer
|
|
6
|
+
class << self
|
|
7
|
+
# Enqueue many emails at once to be delivered through Active Job.
|
|
8
|
+
# When the individual job runs, it will send the email using +deliver_now+.
|
|
9
|
+
def deliver_all_later(*deliveries, **options)
|
|
10
|
+
_deliver_all_later("deliver_now", *deliveries, **options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Enqueue many emails at once to be delivered through Active Job.
|
|
14
|
+
# When the individual job runs, it will send the email using +deliver_now!+.
|
|
15
|
+
# That means that the message will be sent bypassing checking +perform_deliveries+
|
|
16
|
+
# and +raise_delivery_errors+, so use with caution.
|
|
17
|
+
def deliver_all_later!(*deliveries, **options)
|
|
18
|
+
_deliver_all_later("deliver_now!", *deliveries, **options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
def _deliver_all_later(delivery_method, *deliveries, **options)
|
|
23
|
+
deliveries = deliveries.first if deliveries.first.is_a?(Array)
|
|
24
|
+
|
|
25
|
+
jobs = deliveries.map do |delivery|
|
|
26
|
+
mailer_class = delivery.mailer_class
|
|
27
|
+
delivery_job = mailer_class.delivery_job
|
|
28
|
+
|
|
29
|
+
delivery_job
|
|
30
|
+
.new(mailer_class.name, delivery.action.to_s, delivery_method, params: delivery.params, args: delivery.args)
|
|
31
|
+
.set(options)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
ActiveJob.perform_all_later(jobs)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
6
38
|
# = Action Mailer \MessageDelivery
|
|
7
39
|
#
|
|
8
40
|
# The +ActionMailer::MessageDelivery+ class is used by
|
|
@@ -17,6 +49,8 @@ module ActionMailer
|
|
|
17
49
|
# Notifier.welcome(User.first).deliver_later # enqueue email delivery as a job through Active Job
|
|
18
50
|
# Notifier.welcome(User.first).message # a Mail::Message object
|
|
19
51
|
class MessageDelivery < Delegator
|
|
52
|
+
attr_reader :mailer_class, :action, :params, :args # :nodoc:
|
|
53
|
+
|
|
20
54
|
def initialize(mailer_class, action, *args) # :nodoc:
|
|
21
55
|
@mailer_class, @action, @args = mailer_class, action, args
|
|
22
56
|
|
|
@@ -114,14 +114,13 @@ module ActionMailer
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
private
|
|
117
|
-
def method_missing(method_name,
|
|
118
|
-
if @mailer.action_methods.include?(method_name.
|
|
119
|
-
ActionMailer::Parameterized::MessageDelivery.new(@mailer, method_name, @params,
|
|
117
|
+
def method_missing(method_name, ...)
|
|
118
|
+
if @mailer.action_methods.include?(method_name.name)
|
|
119
|
+
ActionMailer::Parameterized::MessageDelivery.new(@mailer, method_name, @params, ...)
|
|
120
120
|
else
|
|
121
121
|
super
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
|
-
ruby2_keywords(:method_missing)
|
|
125
124
|
|
|
126
125
|
def respond_to_missing?(method, include_all = false)
|
|
127
126
|
@mailer.respond_to?(method, include_all)
|
|
@@ -129,11 +128,10 @@ module ActionMailer
|
|
|
129
128
|
end
|
|
130
129
|
|
|
131
130
|
class MessageDelivery < ActionMailer::MessageDelivery # :nodoc:
|
|
132
|
-
def initialize(mailer_class, action, params,
|
|
133
|
-
super(mailer_class, action,
|
|
131
|
+
def initialize(mailer_class, action, params, ...)
|
|
132
|
+
super(mailer_class, action, ...)
|
|
134
133
|
@params = params
|
|
135
134
|
end
|
|
136
|
-
ruby2_keywords(:initialize)
|
|
137
135
|
|
|
138
136
|
private
|
|
139
137
|
def processed_mailer
|
|
@@ -25,31 +25,7 @@ module ActionMailer
|
|
|
25
25
|
mattr_accessor :preview_interceptors, instance_writer: false, default: [ActionMailer::InlinePreviewInterceptor]
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def preview_path
|
|
29
|
-
ActionMailer.deprecator.warn(<<-MSG.squish)
|
|
30
|
-
Using preview_path option is deprecated and will be removed in Rails 7.2.
|
|
31
|
-
Please use preview_paths instead.
|
|
32
|
-
MSG
|
|
33
|
-
self.class.preview_paths.first
|
|
34
|
-
end
|
|
35
|
-
|
|
36
28
|
module ClassMethods
|
|
37
|
-
def preview_path=(value)
|
|
38
|
-
ActionMailer.deprecator.warn(<<-MSG.squish)
|
|
39
|
-
Using preview_path= option is deprecated and will be removed in Rails 7.2.
|
|
40
|
-
Please use preview_paths= instead.
|
|
41
|
-
MSG
|
|
42
|
-
self.preview_paths << value
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def preview_path
|
|
46
|
-
ActionMailer.deprecator.warn(<<-MSG.squish)
|
|
47
|
-
Using preview_path option is deprecated and will be removed in Rails 7.2.
|
|
48
|
-
Please use preview_paths instead.
|
|
49
|
-
MSG
|
|
50
|
-
self.preview_paths.first
|
|
51
|
-
end
|
|
52
|
-
|
|
53
29
|
# Register one or more Interceptors which will be called before mail is previewed.
|
|
54
30
|
def register_preview_interceptors(*interceptors)
|
|
55
31
|
interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "rails"
|
|
3
4
|
require "active_job/railtie"
|
|
4
5
|
require "action_mailer"
|
|
5
|
-
require "rails"
|
|
6
6
|
require "abstract_controller/railties/routes_helpers"
|
|
7
7
|
|
|
8
8
|
module ActionMailer
|
|
@@ -73,12 +73,6 @@ module ActionMailer
|
|
|
73
73
|
app.config.paths["test/mailers/previews"].concat(options.preview_paths)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
initializer "action_mailer.compile_config_methods" do
|
|
77
|
-
ActiveSupport.on_load(:action_mailer) do
|
|
78
|
-
config.compile_methods! if config.respond_to?(:compile_methods!)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
76
|
config.after_initialize do |app|
|
|
83
77
|
options = app.config.action_mailer
|
|
84
78
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support/structured_event_subscriber"
|
|
4
|
+
|
|
5
|
+
module ActionMailer
|
|
6
|
+
class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber # :nodoc:
|
|
7
|
+
# An email was delivered.
|
|
8
|
+
def deliver(event)
|
|
9
|
+
exception = event.payload[:exception_object]
|
|
10
|
+
payload = {
|
|
11
|
+
message_id: event.payload[:message_id],
|
|
12
|
+
duration_ms: event.duration.round(2),
|
|
13
|
+
mail: event.payload[:mail],
|
|
14
|
+
perform_deliveries: event.payload[:perform_deliveries],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if exception
|
|
18
|
+
payload[:exception_class] = exception.class.name
|
|
19
|
+
payload[:exception_message] = exception.message
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
emit_debug_event("action_mailer.delivered", payload)
|
|
23
|
+
end
|
|
24
|
+
debug_only :deliver
|
|
25
|
+
|
|
26
|
+
# An email was generated.
|
|
27
|
+
def process(event)
|
|
28
|
+
emit_debug_event("action_mailer.processed",
|
|
29
|
+
mailer: event.payload[:mailer],
|
|
30
|
+
action: event.payload[:action],
|
|
31
|
+
duration_ms: event.duration.round(2),
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
debug_only :process
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
ActionMailer::StructuredEventSubscriber.attach_to :action_mailer
|
|
@@ -160,26 +160,6 @@ module ActionMailer
|
|
|
160
160
|
mailer = mailer.instance_variable_get(:@mailer)
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
-
if args.is_a?(Hash)
|
|
164
|
-
ActionMailer.deprecator.warn <<~MSG
|
|
165
|
-
Passing a Hash to the assert_enqueued_email_with :args kwarg causes the
|
|
166
|
-
Hash to be treated as params. This behavior is deprecated and will be
|
|
167
|
-
removed in Rails 7.2.
|
|
168
|
-
|
|
169
|
-
To specify a params Hash, use the :params kwarg:
|
|
170
|
-
|
|
171
|
-
assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" }
|
|
172
|
-
|
|
173
|
-
Or, to specify named mailer args as a Hash, wrap the Hash in an array:
|
|
174
|
-
|
|
175
|
-
assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }]
|
|
176
|
-
# OR
|
|
177
|
-
assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"]
|
|
178
|
-
MSG
|
|
179
|
-
|
|
180
|
-
params, args = args, nil
|
|
181
|
-
end
|
|
182
|
-
|
|
183
163
|
args = Array(args) unless args.is_a?(Proc)
|
|
184
164
|
queue ||= mailer.deliver_later_queue_name || ActiveJob::Base.default_queue_name
|
|
185
165
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<% module_namespacing do -%>
|
|
2
2
|
class <%= class_name %>Mailer < ApplicationMailer
|
|
3
|
-
<% actions.
|
|
3
|
+
<% actions.each_with_index do |action, index| -%>
|
|
4
|
+
<% if index != 0 -%>
|
|
4
5
|
|
|
6
|
+
<% end -%>
|
|
5
7
|
# Subject can be set in your I18n file at config/locales/en.yml
|
|
6
8
|
# with the following lookup:
|
|
7
9
|
#
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionmailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,118 +15,70 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 8.1.2.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 8.1.2.1
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: actionpack
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 8.1.2.1
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 8.1.2.1
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: actionview
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 8.1.2.1
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: 8.1.2.1
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: activejob
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
60
|
+
version: 8.1.2.1
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 8.1.2.1
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: mail
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '2.5'
|
|
75
|
-
- - ">="
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
version: 2.5.4
|
|
78
|
-
type: :runtime
|
|
79
|
-
prerelease: false
|
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
81
|
-
requirements:
|
|
82
|
-
- - "~>"
|
|
83
|
-
- !ruby/object:Gem::Version
|
|
84
|
-
version: '2.5'
|
|
85
|
-
- - ">="
|
|
86
|
-
- !ruby/object:Gem::Version
|
|
87
|
-
version: 2.5.4
|
|
88
|
-
- !ruby/object:Gem::Dependency
|
|
89
|
-
name: net-imap
|
|
90
|
-
requirement: !ruby/object:Gem::Requirement
|
|
91
|
-
requirements:
|
|
92
|
-
- - ">="
|
|
93
|
-
- !ruby/object:Gem::Version
|
|
94
|
-
version: '0'
|
|
95
|
-
type: :runtime
|
|
96
|
-
prerelease: false
|
|
97
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
98
|
-
requirements:
|
|
99
|
-
- - ">="
|
|
100
|
-
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0'
|
|
102
|
-
- !ruby/object:Gem::Dependency
|
|
103
|
-
name: net-pop
|
|
104
|
-
requirement: !ruby/object:Gem::Requirement
|
|
105
|
-
requirements:
|
|
106
|
-
- - ">="
|
|
107
|
-
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0'
|
|
109
|
-
type: :runtime
|
|
110
|
-
prerelease: false
|
|
111
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
112
|
-
requirements:
|
|
113
|
-
- - ">="
|
|
114
|
-
- !ruby/object:Gem::Version
|
|
115
|
-
version: '0'
|
|
116
|
-
- !ruby/object:Gem::Dependency
|
|
117
|
-
name: net-smtp
|
|
118
70
|
requirement: !ruby/object:Gem::Requirement
|
|
119
71
|
requirements:
|
|
120
72
|
- - ">="
|
|
121
73
|
- !ruby/object:Gem::Version
|
|
122
|
-
version:
|
|
74
|
+
version: 2.8.0
|
|
123
75
|
type: :runtime
|
|
124
76
|
prerelease: false
|
|
125
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
126
78
|
requirements:
|
|
127
79
|
- - ">="
|
|
128
80
|
- !ruby/object:Gem::Version
|
|
129
|
-
version:
|
|
81
|
+
version: 2.8.0
|
|
130
82
|
- !ruby/object:Gem::Dependency
|
|
131
83
|
name: rails-dom-testing
|
|
132
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -169,6 +121,7 @@ files:
|
|
|
169
121
|
- lib/action_mailer/queued_delivery.rb
|
|
170
122
|
- lib/action_mailer/railtie.rb
|
|
171
123
|
- lib/action_mailer/rescuable.rb
|
|
124
|
+
- lib/action_mailer/structured_event_subscriber.rb
|
|
172
125
|
- lib/action_mailer/test_case.rb
|
|
173
126
|
- lib/action_mailer/test_helper.rb
|
|
174
127
|
- lib/action_mailer/version.rb
|
|
@@ -181,10 +134,10 @@ licenses:
|
|
|
181
134
|
- MIT
|
|
182
135
|
metadata:
|
|
183
136
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
184
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
|
185
|
-
documentation_uri: https://api.rubyonrails.org/
|
|
137
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.1.2.1/actionmailer/CHANGELOG.md
|
|
138
|
+
documentation_uri: https://api.rubyonrails.org/v8.1.2.1/
|
|
186
139
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
187
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
|
140
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.1.2.1/actionmailer
|
|
188
141
|
rubygems_mfa_required: 'true'
|
|
189
142
|
rdoc_options: []
|
|
190
143
|
require_paths:
|
|
@@ -193,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
193
146
|
requirements:
|
|
194
147
|
- - ">="
|
|
195
148
|
- !ruby/object:Gem::Version
|
|
196
|
-
version: 2.
|
|
149
|
+
version: 3.2.0
|
|
197
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
151
|
requirements:
|
|
199
152
|
- - ">="
|
|
@@ -201,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
201
154
|
version: '0'
|
|
202
155
|
requirements:
|
|
203
156
|
- none
|
|
204
|
-
rubygems_version:
|
|
157
|
+
rubygems_version: 4.0.6
|
|
205
158
|
specification_version: 4
|
|
206
159
|
summary: Email composition and delivery framework (part of Rails).
|
|
207
160
|
test_files: []
|