actionmailer 8.0.3 → 8.1.0
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 -36
- data/lib/action_mailer/base.rb +2 -1
- data/lib/action_mailer/form_builder.rb +1 -1
- data/lib/action_mailer/gem_version.rb +2 -2
- data/lib/action_mailer/log_subscriber.rb +1 -5
- data/lib/action_mailer/message_delivery.rb +34 -0
- data/lib/action_mailer/railtie.rb +0 -6
- data/lib/action_mailer/structured_event_subscriber.rb +38 -0
- metadata +13 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88f1f6c224f50cb6b6f9d696849cee934e66006b8e4737d40399803ec7585bf9
|
|
4
|
+
data.tar.gz: e85c8a33fba53b30abb08dea2040f7aef1230cfb4c96b09b4c5a72f826eef92a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66634214e536663cfc491fb82d1aeda9967e7a3915ec99b411695cdf4bfd9ef60ded5761187645497bfc312526dc2fc7678d0a86d098ba9a623f3fdd04279537
|
|
7
|
+
data.tar.gz: 2a809be068e48230d06c1cf37648de4956f0fbbd0078e344f5c32d4f38303d1dda9c4554a5f54e0cb9d8efe39f1f903fe52087fcf709eb76f23df699a8b230fa
|
data/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,25 @@
|
|
|
1
|
-
## Rails 8.0
|
|
1
|
+
## Rails 8.1.0 (October 22, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Add structured events for Action Mailer:
|
|
4
|
+
- `action_mailer.delivered`
|
|
5
|
+
- `action_mailer.processed`
|
|
4
6
|
|
|
7
|
+
*Gannon McGibbon*
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
* Add `deliver_all_later` to enqueue multiple emails at once.
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
```ruby
|
|
12
|
+
user_emails = User.all.map { |user| Notifier.welcome(user) }
|
|
13
|
+
ActionMailer.deliver_all_later(user_emails)
|
|
9
14
|
|
|
15
|
+
# use a custom queue
|
|
16
|
+
ActionMailer.deliver_all_later(user_emails, queue: :my_queue)
|
|
17
|
+
```
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
This can greatly reduce the number of round-trips to the queue datastore.
|
|
20
|
+
For queue adapters that do not implement the `enqueue_all` method, we
|
|
21
|
+
fall back to enqueuing email jobs indvidually.
|
|
12
22
|
|
|
13
|
-
*
|
|
23
|
+
*fatkodima*
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
## Rails 8.0.1 (December 13, 2024) ##
|
|
17
|
-
|
|
18
|
-
* No changes.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
22
|
-
|
|
23
|
-
* No changes.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Rails 8.0.0 (November 07, 2024) ##
|
|
27
|
-
|
|
28
|
-
* No changes.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
32
|
-
|
|
33
|
-
* No changes.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
37
|
-
|
|
38
|
-
* No changes.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionmailer/CHANGELOG.md) for previous changes.
|
|
25
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionmailer/CHANGELOG.md) for previous changes.
|
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
|
|
@@ -930,7 +931,7 @@ module ActionMailer
|
|
|
930
931
|
# If the subject has interpolations, you can pass them through the +interpolations+ parameter.
|
|
931
932
|
def default_i18n_subject(interpolations = {}) # :doc:
|
|
932
933
|
mailer_scope = self.class.mailer_name.tr("/", ".")
|
|
933
|
-
I18n.t(:subject, **interpolations
|
|
934
|
+
I18n.t(:subject, **interpolations, scope: [mailer_scope, action_name], default: action_name.humanize)
|
|
934
935
|
end
|
|
935
936
|
|
|
936
937
|
# Emails do not support relative path links.
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -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
|
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: 8.0
|
|
4
|
+
version: 8.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,56 +15,56 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 8.0
|
|
18
|
+
version: 8.1.0
|
|
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: 8.0
|
|
25
|
+
version: 8.1.0
|
|
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: 8.0
|
|
32
|
+
version: 8.1.0
|
|
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: 8.0
|
|
39
|
+
version: 8.1.0
|
|
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: 8.0
|
|
46
|
+
version: 8.1.0
|
|
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: 8.0
|
|
53
|
+
version: 8.1.0
|
|
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: 8.0
|
|
60
|
+
version: 8.1.0
|
|
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: 8.0
|
|
67
|
+
version: 8.1.0
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: mail
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -121,6 +121,7 @@ files:
|
|
|
121
121
|
- lib/action_mailer/queued_delivery.rb
|
|
122
122
|
- lib/action_mailer/railtie.rb
|
|
123
123
|
- lib/action_mailer/rescuable.rb
|
|
124
|
+
- lib/action_mailer/structured_event_subscriber.rb
|
|
124
125
|
- lib/action_mailer/test_case.rb
|
|
125
126
|
- lib/action_mailer/test_helper.rb
|
|
126
127
|
- lib/action_mailer/version.rb
|
|
@@ -133,10 +134,10 @@ licenses:
|
|
|
133
134
|
- MIT
|
|
134
135
|
metadata:
|
|
135
136
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
136
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0
|
|
137
|
-
documentation_uri: https://api.rubyonrails.org/v8.0
|
|
137
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.1.0/actionmailer/CHANGELOG.md
|
|
138
|
+
documentation_uri: https://api.rubyonrails.org/v8.1.0/
|
|
138
139
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
139
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0
|
|
140
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.1.0/actionmailer
|
|
140
141
|
rubygems_mfa_required: 'true'
|
|
141
142
|
rdoc_options: []
|
|
142
143
|
require_paths:
|