actionmailer 7.2.2.1 → 8.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c11aff9a531baec43ef53e43297b9fad9b5b1320e15089a50882dea492089b3e
4
- data.tar.gz: 36035769d7005800933e17050cc20451041da2704871f44fc3d1087eae452f44
3
+ metadata.gz: efcff855a542fd1e2ee8f6204c533995093c7cbae6ae69add061a21530e33a4e
4
+ data.tar.gz: aa3c25e20805bdc9185a3311b24eae32f4c83850811e4bbccceebb4de5b811fd
5
5
  SHA512:
6
- metadata.gz: 2b929b02d7ca792849fc3a6af4efe1331b3fd5db624ba5931adca0271d6b5faa201dd395b221b60fc7c8869b251b8ff8cb1f19131531bb88356684684c962c5a
7
- data.tar.gz: a62791462cce39d377c74b5ce8df83dbb789d17cffc05036c3d149f04c3bc5212261ac144ec0d6148502f969094ecb896daf9e4af392a01d90fc6a2312dbc7a0
6
+ metadata.gz: a1cc5cf65613e05fb3fc751d3eea19238a14a148b3fb0445212c307fb06fd36217bc48fd02814232a14f0c7682214187c9c757593cbecb34083eda8bf5af3595
7
+ data.tar.gz: 408899a5053a0a52230092f107ef9c2a11bde955846f2b6c450568b2f0a9122cc2bb82544a2b5b5dd1403de61edeae8cef7a06aafde4985ce13ac11301c44777
data/CHANGELOG.md CHANGED
@@ -1,42 +1,35 @@
1
- ## Rails 7.2.2.1 (December 10, 2024) ##
1
+ ## Rails 8.1.2 (January 08, 2026) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 7.2.2 (October 30, 2024) ##
6
+ ## Rails 8.1.1 (October 28, 2025) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 7.2.1.2 (October 23, 2024) ##
11
+ ## Rails 8.1.0 (October 22, 2025) ##
12
12
 
13
- * Fix NoMethodError in `block_format` helper
13
+ * Add structured events for Action Mailer:
14
+ - `action_mailer.delivered`
15
+ - `action_mailer.processed`
14
16
 
15
- *Michael Leimstaedtner*
17
+ *Gannon McGibbon*
16
18
 
19
+ * Add `deliver_all_later` to enqueue multiple emails at once.
17
20
 
18
- ## Rails 7.2.1.1 (October 15, 2024) ##
21
+ ```ruby
22
+ user_emails = User.all.map { |user| Notifier.welcome(user) }
23
+ ActionMailer.deliver_all_later(user_emails)
19
24
 
20
- * Avoid regex backtracking in `block_format` helper
25
+ # use a custom queue
26
+ ActionMailer.deliver_all_later(user_emails, queue: :my_queue)
27
+ ```
21
28
 
22
- [CVE-2024-47889]
29
+ This can greatly reduce the number of round-trips to the queue datastore.
30
+ For queue adapters that do not implement the `enqueue_all` method, we
31
+ fall back to enqueuing email jobs indvidually.
23
32
 
24
- *John Hawthorn*
33
+ *fatkodima*
25
34
 
26
-
27
- ## Rails 7.2.1 (August 22, 2024) ##
28
-
29
- * No changes.
30
-
31
-
32
- ## Rails 7.2.0 (August 09, 2024) ##
33
-
34
- * Remove deprecated params via `:args` for `assert_enqueued_email_with`.
35
-
36
- *Rafael Mendonça França*
37
-
38
- * Remove deprecated `config.action_mailer.preview_path`.
39
-
40
- *Rafael Mendonça França*
41
-
42
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionmailer/CHANGELOG.md) for previous changes.
35
+ 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 rails-core mailing list here:
139
+ Feature requests should be discussed on the rubyonrails-core forum here:
140
140
 
141
141
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -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
- # Sets the defaults through app configuration:
578
- #
579
- # config.action_mailer.default(from: "no-reply@example.org")
578
+ # Allows to set defaults through app configuration:
580
579
  #
581
- # Aliased by ::default_options=
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.
@@ -935,7 +931,7 @@ module ActionMailer
935
931
  # If the subject has interpolations, you can pass them through the +interpolations+ parameter.
936
932
  def default_i18n_subject(interpolations = {}) # :doc:
937
933
  mailer_scope = self.class.mailer_name.tr("/", ".")
938
- I18n.t(:subject, **interpolations.merge(scope: [mailer_scope, action_name], default: action_name.humanize))
934
+ I18n.t(:subject, **interpolations, scope: [mailer_scope, action_name], default: action_name.humanize)
939
935
  end
940
936
 
941
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
@@ -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, an instance of ActionView::Helpers::FormBuilder
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
@@ -7,10 +7,10 @@ module ActionMailer
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 7
11
- MINOR = 2
10
+ MAJOR = 8
11
+ MINOR = 1
12
12
  TINY = 2
13
- PRE = "1"
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  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: style URLs to data: style URLs so that they are visible
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
- # = Action Mailer \LogSubscriber
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
 
@@ -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
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2.1
4
+ version: 8.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,56 +15,56 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 7.2.2.1
18
+ version: 8.1.2
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 7.2.2.1
25
+ version: 8.1.2
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: actionpack
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - '='
32
31
  - !ruby/object:Gem::Version
33
- version: 7.2.2.1
32
+ version: 8.1.2
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - '='
39
38
  - !ruby/object:Gem::Version
40
- version: 7.2.2.1
39
+ version: 8.1.2
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: actionview
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - '='
46
45
  - !ruby/object:Gem::Version
47
- version: 7.2.2.1
46
+ version: 8.1.2
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - '='
53
52
  - !ruby/object:Gem::Version
54
- version: 7.2.2.1
53
+ version: 8.1.2
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: activejob
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - '='
60
59
  - !ruby/object:Gem::Version
61
- version: 7.2.2.1
60
+ version: 8.1.2
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - '='
67
66
  - !ruby/object:Gem::Version
68
- version: 7.2.2.1
67
+ version: 8.1.2
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: mail
71
70
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +121,7 @@ files:
122
121
  - lib/action_mailer/queued_delivery.rb
123
122
  - lib/action_mailer/railtie.rb
124
123
  - lib/action_mailer/rescuable.rb
124
+ - lib/action_mailer/structured_event_subscriber.rb
125
125
  - lib/action_mailer/test_case.rb
126
126
  - lib/action_mailer/test_helper.rb
127
127
  - lib/action_mailer/version.rb
@@ -134,12 +134,11 @@ licenses:
134
134
  - MIT
135
135
  metadata:
136
136
  bug_tracker_uri: https://github.com/rails/rails/issues
137
- changelog_uri: https://github.com/rails/rails/blob/v7.2.2.1/actionmailer/CHANGELOG.md
138
- documentation_uri: https://api.rubyonrails.org/v7.2.2.1/
137
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.2/actionmailer/CHANGELOG.md
138
+ documentation_uri: https://api.rubyonrails.org/v8.1.2/
139
139
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
140
- source_code_uri: https://github.com/rails/rails/tree/v7.2.2.1/actionmailer
140
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.2/actionmailer
141
141
  rubygems_mfa_required: 'true'
142
- post_install_message:
143
142
  rdoc_options: []
144
143
  require_paths:
145
144
  - lib
@@ -147,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
146
  requirements:
148
147
  - - ">="
149
148
  - !ruby/object:Gem::Version
150
- version: 3.1.0
149
+ version: 3.2.0
151
150
  required_rubygems_version: !ruby/object:Gem::Requirement
152
151
  requirements:
153
152
  - - ">="
@@ -155,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
154
  version: '0'
156
155
  requirements:
157
156
  - none
158
- rubygems_version: 3.5.22
159
- signing_key:
157
+ rubygems_version: 4.0.3
160
158
  specification_version: 4
161
159
  summary: Email composition and delivery framework (part of Rails).
162
160
  test_files: []