aws-actionmailer-ses 1.1.0 → 1.2.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 +5 -0
- data/VERSION +1 -1
- data/lib/aws/action_mailer/ses_v2/mailer.rb +47 -4
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e84d63cd92cc606c4436f3f34e07e79c422b3a46f05b405ae7f2b774431781f1
|
|
4
|
+
data.tar.gz: b02a20505f08ecc019dd160be181eafb9b1a64567bc7abce2f8a9b26c06e631f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fee74b70ebd190204cb83abd71e6e04b04f1495dc40f36b68fc746eaebb0c35feb48d681fb89bc185000c4c9aca48333882bf454889a8aed0cf2318f522a043e
|
|
7
|
+
data.tar.gz: 58692d241e18004f35b1054ceb9f28c73defb91e7f807e01dd464edde5c79bb3196bc1d9dff82bf2d2a0049df5c6e6560ac35fa238c86289691f88b13c5e3d53
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.2.0
|
|
@@ -7,18 +7,45 @@ 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.
|
|
11
10
|
# Once you have a delivery method, you can configure your Rails environment to use it:
|
|
12
11
|
#
|
|
13
12
|
# config.action_mailer.delivery_method = :ses_v2
|
|
14
13
|
# config.action_mailer.ses_v2_settings = { region: 'us-west-2' }
|
|
15
14
|
#
|
|
16
|
-
#
|
|
15
|
+
# You may also pass a preconstructed client:
|
|
17
16
|
#
|
|
18
|
-
#
|
|
17
|
+
# sesv2_client = Aws::SESV2::Client.new(region: 'us-west-2')
|
|
18
|
+
# config.action_mailer.ses_v2_settings = { sesv2_client: sesv2_client }
|
|
19
|
+
#
|
|
20
|
+
# == SendEmail Options
|
|
21
|
+
#
|
|
22
|
+
# Settings in {SEND_EMAIL_KEYS} are forwarded directly to the
|
|
23
|
+
# {https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#send_email-instance_method SendEmail}
|
|
24
|
+
# API call rather than to the client constructor. They can be configured at
|
|
25
|
+
# any level:
|
|
26
|
+
#
|
|
27
|
+
# # Global (all emails)
|
|
28
|
+
# config.action_mailer.ses_v2_settings = {
|
|
29
|
+
# region: 'us-west-2',
|
|
30
|
+
# configuration_set_name: 'Production'
|
|
31
|
+
# }
|
|
32
|
+
#
|
|
33
|
+
# # Per-mailer class
|
|
34
|
+
# class MarketingMailer < ApplicationMailer
|
|
35
|
+
# default delivery_method_options: {
|
|
36
|
+
# configuration_set_name: 'Marketing',
|
|
37
|
+
# list_management_options: { contact_list_name: 'Promos', topic_name: 'Weekly' }
|
|
38
|
+
# }
|
|
39
|
+
# end
|
|
19
40
|
#
|
|
20
41
|
# @see https://guides.rubyonrails.org/action_mailer_basics.html
|
|
21
42
|
class Mailer
|
|
43
|
+
SEND_EMAIL_KEYS = %i[
|
|
44
|
+
configuration_set_name
|
|
45
|
+
email_tags
|
|
46
|
+
list_management_options
|
|
47
|
+
].freeze
|
|
48
|
+
|
|
22
49
|
attr_reader :settings
|
|
23
50
|
|
|
24
51
|
# @param [Hash] settings
|
|
@@ -26,16 +53,31 @@ module Aws
|
|
|
26
53
|
# You may pass `:sesv2_client` with a preconstructed {Aws::SESV2::Client} to reuse
|
|
27
54
|
# an existing instance (e.g. to avoid credential resolution on every delivery).
|
|
28
55
|
# When provided, the injected client is used and all other options are ignored.
|
|
56
|
+
#
|
|
57
|
+
# The following keys are extracted from settings and forwarded as parameters
|
|
58
|
+
# to the [SendEmail](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#send_email-instance_method)
|
|
59
|
+
# API call (they are not passed to the client constructor):
|
|
60
|
+
#
|
|
61
|
+
# * `:configuration_set_name` - The name of the configuration set to use for this message.
|
|
62
|
+
# * `:email_tags` - A list of message tags ({Types::MessageTag} hashes).
|
|
63
|
+
# * `:list_management_options` - A {Types::ListManagementOptions} hash for SES
|
|
64
|
+
# subscription management.
|
|
65
|
+
#
|
|
29
66
|
def initialize(settings = {})
|
|
30
67
|
@settings = settings
|
|
68
|
+
@send_email_params = {}
|
|
31
69
|
client_settings = settings.dup
|
|
70
|
+
SEND_EMAIL_KEYS.each do |key|
|
|
71
|
+
value = client_settings.delete(key)
|
|
72
|
+
@send_email_params[key] = value if value
|
|
73
|
+
end
|
|
32
74
|
@client = client_settings.delete(:sesv2_client) || Aws::SESV2::Client.new(client_settings)
|
|
33
75
|
|
|
34
76
|
update_user_agent
|
|
35
77
|
end
|
|
36
78
|
|
|
37
79
|
# Delivers a Mail::Message object. Called during mail delivery.
|
|
38
|
-
def deliver!(message)
|
|
80
|
+
def deliver!(message) # rubocop:disable Metrics/MethodLength
|
|
39
81
|
params = { content: { raw: { data: message.to_s } } }
|
|
40
82
|
params[:from_email_address] = from_email_address(message)
|
|
41
83
|
params[:destination] = {
|
|
@@ -43,6 +85,7 @@ module Aws
|
|
|
43
85
|
cc_addresses: message.cc,
|
|
44
86
|
bcc_addresses: message.bcc
|
|
45
87
|
}
|
|
88
|
+
params.merge!(@send_email_params)
|
|
46
89
|
|
|
47
90
|
@client.send_email(params).tap do |response|
|
|
48
91
|
message.header[:ses_message_id] = response.message_id
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aws-actionmailer-ses
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Amazon Web Services
|
|
@@ -80,7 +80,10 @@ files:
|
|
|
80
80
|
homepage: https://github.com/aws/aws-actionmailer-ses-ruby
|
|
81
81
|
licenses:
|
|
82
82
|
- Apache-2.0
|
|
83
|
-
metadata:
|
|
83
|
+
metadata:
|
|
84
|
+
source_code_uri: https://github.com/aws/aws-actionmailer-ses-ruby
|
|
85
|
+
changelog_uri: https://github.com/aws/aws-actionmailer-ses-ruby/blob/main/CHANGELOG.md
|
|
86
|
+
documentation_uri: https://docs.aws.amazon.com/sdk-for-ruby/aws-actionmailer-ses/api/
|
|
84
87
|
rdoc_options: []
|
|
85
88
|
require_paths:
|
|
86
89
|
- lib
|
|
@@ -95,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
98
|
- !ruby/object:Gem::Version
|
|
96
99
|
version: '0'
|
|
97
100
|
requirements: []
|
|
98
|
-
rubygems_version:
|
|
101
|
+
rubygems_version: 4.0.6
|
|
99
102
|
specification_version: 4
|
|
100
103
|
summary: ActionMailer integration with SES
|
|
101
104
|
test_files: []
|