aws-actionmailer-ses 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5155bf8bc7c5caf160e77e7768a0029fe7514e7d33d9ab14544072e64bb96cf
4
- data.tar.gz: a281ec02f365a903eade4ef008fde838b5748100211b3e2fa37aac1909d9dcff
3
+ metadata.gz: ec867bd416f2def54b5dda14e9f3621ae8874dbaab3915c8931f81d3a3483f6e
4
+ data.tar.gz: 72507e750b1240ec40675098c025d0825d55c690f1b7dc6e0839060d979ae3cb
5
5
  SHA512:
6
- metadata.gz: c865beacd6615da65f966d7e89cf145bf301d72babec69915c7a1e74c277048d2005c86634857156f71088a37898623c8349a90f5cddd77ce20c1a38735f9ae3
7
- data.tar.gz: 2d4ebed009cc45470df4b4ab9c2258dbc8737ec00b885c34abc7b0f570165cb26f01b597c737e4cef5b206563442333f1bc02c2fac4725b78a8a7a23648e68ab
6
+ metadata.gz: 997665131266a6d065c0e4fa55f10e0d376812a1c8a1e636948141bc75f30f0337291bddac00058333ad8b59da851deabea768179f73a9d4393b1c2a61f855d8
7
+ data.tar.gz: cf9adf87de27c4eaee187663c5aa00c96ad34558a727dc4e04579bd9e53668d2e79943c1d749ca6f8e8a9ef6afa047ee73c31e4b4826df6575fa6963a1a8cdb9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.1.0 (2026-03-31)
2
+ ------------------
3
+
4
+ * Feature - Support injecting a preconstructed client via `:ses_client` and `:sesv2_client` options.
5
+
1
6
  1.0.0 (2024-11-21)
2
7
  ------------------
3
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -7,22 +7,31 @@ module Aws
7
7
  module SES
8
8
  # Provides a delivery method for ActionMailer that uses Amazon Simple Email Service.
9
9
  #
10
- # Delivery settings are used to construct a new Aws::SES::Client instance.
10
+ # Delivery settings are used to construct a new `Aws::SES::Client` instance.
11
11
  # Once you have a delivery method, you can configure your Rails environment to use it:
12
12
  #
13
13
  # config.action_mailer.delivery_method = :ses
14
14
  # config.action_mailer.ses_settings = { region: 'us-west-2' }
15
15
  #
16
+ # Alternatively, you could pass the client itself.
17
+ #
18
+ # The passed in client will be prioritized regardless of other `:ses_settings` given.
19
+ #
16
20
  # @see https://guides.rubyonrails.org/action_mailer_basics.html
17
21
  class Mailer
18
22
  attr_reader :settings
19
23
 
20
- # @param [Hash] settings Passes along initialization options to
21
- # [Aws::SES::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#initialize-instance_method).
24
+ # @param [Hash] settings
25
+ # Passes along initialization options to [Aws::SES::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#initialize-instance_method).
26
+ # You may pass `:ses_client` with a preconstructed {Aws::SES::Client} to reuse
27
+ # an existing instance (e.g. to avoid credential resolution on every delivery).
28
+ # When provided, the injected client is used and all other options are ignored.
22
29
  def initialize(settings = {})
23
30
  @settings = settings
24
- @client = Aws::SES::Client.new(settings)
25
- @client.config.user_agent_frameworks << 'aws-actionmailer-ses'
31
+ client_settings = settings.dup
32
+ @client = client_settings.delete(:ses_client) || Aws::SES::Client.new(client_settings)
33
+
34
+ update_user_agent
26
35
  end
27
36
 
28
37
  # Delivers a Mail::Message object. Called during mail delivery.
@@ -36,6 +45,14 @@ module Aws
36
45
  message.header[:ses_message_id] = response.message_id
37
46
  end
38
47
  end
48
+
49
+ private
50
+
51
+ def update_user_agent
52
+ return if @client.config.user_agent_frameworks.include?('aws-actionmailer-ses')
53
+
54
+ @client.config.user_agent_frameworks << 'aws-actionmailer-ses'
55
+ end
39
56
  end
40
57
  end
41
58
  end
@@ -7,22 +7,31 @@ module Aws
7
7
  module SESV2
8
8
  # Provides a delivery method for ActionMailer that uses Amazon Simple Email Service V2.
9
9
  #
10
- # Delivery settings are used to construct a new Aws::SESV2::Client instance.
10
+ # Delivery settings are used to construct a new `Aws::SESV2::Client` instance.
11
11
  # Once you have a delivery method, you can configure your Rails environment to use it:
12
12
  #
13
13
  # config.action_mailer.delivery_method = :ses_v2
14
14
  # config.action_mailer.ses_v2_settings = { region: 'us-west-2' }
15
15
  #
16
+ # Alternatively, you could pass the client itself.
17
+ #
18
+ # The passed in client will be prioritized regardless of other `:ses_v2_settings` given.
19
+ #
16
20
  # @see https://guides.rubyonrails.org/action_mailer_basics.html
17
21
  class Mailer
18
22
  attr_reader :settings
19
23
 
20
- # @param [Hash] settings Passes along initialization settings to
21
- # [Aws::SESV2::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#initialize-instance_method).
24
+ # @param [Hash] settings
25
+ # Passes along initialization settings to [Aws::SESV2::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#initialize-instance_method).
26
+ # You may pass `:sesv2_client` with a preconstructed {Aws::SESV2::Client} to reuse
27
+ # an existing instance (e.g. to avoid credential resolution on every delivery).
28
+ # When provided, the injected client is used and all other options are ignored.
22
29
  def initialize(settings = {})
23
30
  @settings = settings
24
- @client = Aws::SESV2::Client.new(settings)
25
- @client.config.user_agent_frameworks << 'aws-actionmailer-ses'
31
+ client_settings = settings.dup
32
+ @client = client_settings.delete(:sesv2_client) || Aws::SESV2::Client.new(client_settings)
33
+
34
+ update_user_agent
26
35
  end
27
36
 
28
37
  # Delivers a Mail::Message object. Called during mail delivery.
@@ -42,6 +51,12 @@ module Aws
42
51
 
43
52
  private
44
53
 
54
+ def update_user_agent
55
+ return if @client.config.user_agent_frameworks.include?('aws-actionmailer-ses')
56
+
57
+ @client.config.user_agent_frameworks << 'aws-actionmailer-ses'
58
+ end
59
+
45
60
  # smtp_envelope_from will default to the From address *without* sender names.
46
61
  # By omitting this param, SESv2 will correctly use sender names from the mail headers.
47
62
  # We should only use smtp_envelope_from when it was explicitly set (instance variable set)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-actionmailer-ses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-21 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: aws-sdk-ses
@@ -82,7 +81,6 @@ homepage: https://github.com/aws/aws-actionmailer-ses-ruby
82
81
  licenses:
83
82
  - Apache-2.0
84
83
  metadata: {}
85
- post_install_message:
86
84
  rdoc_options: []
87
85
  require_paths:
88
86
  - lib
@@ -97,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  - !ruby/object:Gem::Version
98
96
  version: '0'
99
97
  requirements: []
100
- rubygems_version: 3.5.11
101
- signing_key:
98
+ rubygems_version: 3.6.9
102
99
  specification_version: 4
103
100
  summary: ActionMailer integration with SES
104
101
  test_files: []