mail-ses 1.0.0 → 1.0.3

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: 5076a7ce9398b8272a112f6ef1c3617459147ce22a1c9086f7c5e27dfa0b537d
4
- data.tar.gz: 97cb25004d481a9d9c8129db9248513b4ff08c6b68a298c307a137210554fff6
3
+ metadata.gz: f36fa8ab1100cbb6f4fe9702bb821a133a476a3819fd638f9ef92c1abeb99b8b
4
+ data.tar.gz: 3e2c95acbc148a29c1a7cb21342d0e4de459ef3ac83e1bfdf8aceb73ad1e1c30
5
5
  SHA512:
6
- metadata.gz: 3fe5da3cc1004f2dd7c05a7ce444c8c0453b1c599b4066085b1673f30fd75b475184168a2cc585e59eaebed9a032195c1d67253bbf29b6a9fbb396eb3b849cdc
7
- data.tar.gz: 5847f439fa23d06aea8c1af63b4514ff0c90b1d4012c2919a6ebef05d2f31ec5563b0cd02945e0df03018f72a054883b328a21283c380af5ab2226a6a082fba6
6
+ metadata.gz: d8da07c2fd176ec7d44b5944ae1defd6f5406cb83ced2877ab4a7bf8caefe6b91b12a09f4fff084e5efb4c4866f17e2728d0d0a17c21ede5909fedbc1367e963
7
+ data.tar.gz: 2d488a916475fc9bfc4d1d206c3f7316e8873d213d3f249267a41abc4549d1d61bbb4fb2bf7bdbef89fde299d8f79022982a33c72fcf25525eb7cbc98289efda
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.0.3
4
+
5
+ - Support UTF-8 chars in from, to, etc addresses.
6
+
7
+ ### 1.0.2
8
+
9
+ - Fix labels in being stripped from email addresses.
10
+ - Support Reply-To address.
11
+
12
+ ### 1.0.1
13
+
14
+ - Add compatibility with Mail gem 2.8.0.
15
+
3
16
  ### 1.0.0
4
17
 
5
18
  - BREAKING CHANGE: Upgrade to AWS Ruby SDK v3 - SESv2 API ([@khrvi](https://github.com/khrvi))
@@ -25,7 +25,11 @@ module Mail
25
25
  end
26
26
 
27
27
  def validate_delivery_params
28
- Mail::CheckDeliveryParams.check(@message)
28
+ if defined?(Mail::CheckDeliveryParams) # mail gem < 2.7.0
29
+ Mail::CheckDeliveryParams.check(@message)
30
+ elsif defined?(Mail::SmtpEnvelope) # mail gem >= 2.8.0
31
+ Mail::SmtpEnvelope.new(@message)
32
+ end
29
33
  end
30
34
 
31
35
  def validate_attachments
@@ -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,14 @@ 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
+ @message.header[key]&.formatted&.map { |v| encode(v) }
54
+ end
55
+
56
+ def encode(value)
57
+ Mail::Encodings.address_encode(value)
58
+ end
41
59
  end
42
60
  end
43
61
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mail
4
4
  class SES
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.3'
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.0
4
+ version: 1.0.3
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-22 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sesv2
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.2.3
145
+ rubygems_version: 3.3.13
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Ruby Mail delivery method handler for Amazon SES