mail-ses 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85feb11fd75e0a0af6ccc3c6a2d9711a48e9444db1fb2bec25f407a7388da165
4
- data.tar.gz: d32dd2fe4aa147b3d1a08b1d65aa4cf92ce4001fd6318e23b9d05f0a7c97433a
3
+ metadata.gz: a689b342f844767cae3e35b937b0e95bb997d61087989f78f21ed8b48977d318
4
+ data.tar.gz: 989ef38af6e8cf6bd32cfb0ec8dee37ecbf272652609fcca140c169b4f02626f
5
5
  SHA512:
6
- metadata.gz: 66f8925d0f8f0cc657b0fcb26868d1ee57010360747e5782f8126f28a5054004a6a20a5d3358608617eb900d5429adebbe16e0eaa9b98567f3ad048b806743c9
7
- data.tar.gz: 339a15c00b6664a1266a3ea7dbe390ad684a434785fcc4670cb1f0a8c5b9409d3a7cc26892cf4c5d88a639c32c64671b1c56d224ec7ef9cc66188c9326b30506
6
+ metadata.gz: d6bb222bc4117cb8136ae3a91e3e2eff7cfff64f2b7b303f7c5d02ca9b6bb298c193006ce6b3f2daadd09df3b8bc27daefe7499a18323247ed3fe17a9ff56667
7
+ data.tar.gz: e7d4b9dbfb1056a6211b16bf5764835e9768b1fb67db77ada7f5fd060c6e9158a22440bfadd83e75ba8be561469bfcd53ffdac876dc034c1481fa6c8395741a7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.0.4
4
+
5
+ - Fix missing method error related to message headers.
6
+
7
+ ### 1.0.3
8
+
9
+ - Support UTF-8 chars in from, to, etc addresses.
10
+
11
+ ### 1.0.2
12
+
13
+ - Fix labels in being stripped from email addresses.
14
+ - Support Reply-To address.
15
+
3
16
  ### 1.0.1
4
17
 
5
18
  - Add compatibility with Mail gem 2.8.0.
@@ -4,6 +4,14 @@ module Mail
4
4
  class SES
5
5
  # Builds options for Aws::SESV2::Client#send_email
6
6
  class OptionsBuilder
7
+ SES_FIELDS = %i[ from_email_address
8
+ from_email_address_identity_arn
9
+ reply_to_addresses
10
+ feedback_forwarding_email_address
11
+ feedback_forwarding_email_address_identity_arn
12
+ email_tags
13
+ configuration_set_name ].freeze
14
+
7
15
  # message - The Mail::Message object to be sent.
8
16
  # options - The Hash options which override any defaults
9
17
  # from the message.
@@ -20,16 +28,18 @@ module Mail
20
28
  private
21
29
 
22
30
  def ses_options
23
- slice_hash(@options, *RAW_EMAIL_ATTRS)
31
+ # TODO: address fields should be encoded to UTF-8
32
+ slice_hash(@options, *SES_FIELDS)
24
33
  end
25
34
 
26
35
  def message_options
27
36
  {
28
- from_email_address: @message.from&.first,
37
+ from_email_address: extract_value(:from)&.first,
38
+ reply_to_addresses: extract_value(:reply_to),
29
39
  destination: {
30
- to_addresses: Array(@message.to).compact,
31
- cc_addresses: Array(@message.cc).compact,
32
- bcc_addresses: Array(@message.bcc).compact
40
+ to_addresses: extract_value(:to) || [],
41
+ cc_addresses: extract_value(:cc) || [],
42
+ bcc_addresses: extract_value(:bcc) || []
33
43
  },
34
44
  content: { raw: { data: @message.to_s } }
35
45
  }.compact
@@ -38,6 +48,17 @@ module Mail
38
48
  def slice_hash(hash, *keys)
39
49
  keys.each_with_object({}) { |k, h| h[k] = hash[k] if hash.key?(k) }
40
50
  end
51
+
52
+ def extract_value(key)
53
+ value = @message.header[key]
54
+ return unless value.respond_to?(:formatted)
55
+
56
+ value.formatted&.map { |v| encode(v) }
57
+ end
58
+
59
+ def encode(value)
60
+ Mail::Encodings.address_encode(value)
61
+ end
41
62
  end
42
63
  end
43
64
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mail
4
4
  class SES
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.4'
6
6
  end
7
7
  end
data/lib/mail/ses.rb CHANGED
@@ -7,13 +7,6 @@ require 'mail/ses/options_builder'
7
7
  module Mail
8
8
  # Mail delivery method handler for AWS SES
9
9
  class SES
10
- RAW_EMAIL_ATTRS = %i[ from_email_address
11
- from_email_address_identity_arn
12
- feedback_forwarding_email_address
13
- feedback_forwarding_email_address_identity_arn
14
- email_tags
15
- configuration_set_name ].freeze
16
-
17
10
  attr_accessor :settings
18
11
  attr_reader :client
19
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail-ses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnny Shields
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-27 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sesv2