mailtrap 2.0.0 → 2.1.1
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/.rubocop.yml +11 -5
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +65 -41
- data/README.md +22 -7
- data/lib/mailtrap/attachment.rb +1 -1
- data/lib/mailtrap/mail.rb +17 -4
- data/lib/mailtrap/version.rb +1 -1
- data/mailtrap.gemspec +1 -1
- metadata +3 -4
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30f80c3c771f5d73e22d3731d3f8d619793be03b378f48251e0e17e0e33d5d60
|
|
4
|
+
data.tar.gz: 41523de1f211b8ef4900efe6abd2343afb67803921fe495372c1d780d5b0f6fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 781f8682fec57e56274d6de148bf24cc2d21ae8582e31a00585eaceb15481cf8b8508f9f1ba7f32b54e71c3c18b5062a6f2be407f5e14df0b78b5038a1086e9e
|
|
7
|
+
data.tar.gz: 1f22fc8e1c76efb7e0050d68b731ea0ceba6a65a8d37cea1da72369d41287f657492e005683648b1b7279e15e059f6c14a4ec724015763f2d212bde1407dd097
|
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
require:
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
|
|
5
|
+
inherit_mode:
|
|
6
|
+
merge:
|
|
7
|
+
- Exclude
|
|
2
8
|
|
|
3
9
|
AllCops:
|
|
4
|
-
TargetRubyVersion:
|
|
10
|
+
TargetRubyVersion: 3.0
|
|
5
11
|
NewCops: enable
|
|
6
12
|
Exclude:
|
|
7
|
-
-
|
|
13
|
+
- "gemfiles/**/*"
|
|
8
14
|
|
|
9
15
|
Layout/LineLength:
|
|
10
16
|
Max: 120
|
|
@@ -34,8 +40,8 @@ Style/StringLiteralsInInterpolation:
|
|
|
34
40
|
|
|
35
41
|
Style/FrozenStringLiteralComment:
|
|
36
42
|
Exclude:
|
|
37
|
-
-
|
|
43
|
+
- "examples/**/*"
|
|
38
44
|
|
|
39
45
|
Style/TrailingCommaInHashLiteral:
|
|
40
46
|
Exclude:
|
|
41
|
-
-
|
|
47
|
+
- "examples/**/*"
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [2.1.1] - 2024-12-11
|
|
2
|
+
|
|
3
|
+
- Improved handling of empty `from`
|
|
4
|
+
|
|
5
|
+
## [2.1.0] - 2024-07-08
|
|
6
|
+
|
|
7
|
+
- Fixed extraneous headers added by ActionMailer #21
|
|
8
|
+
- Dropped Ruby 2.7 support and added test coverage for Ruby up to 3.3 #22
|
|
9
|
+
|
|
1
10
|
## [2.0.0] - 2024-03-20
|
|
2
11
|
|
|
3
12
|
- Added arguments for `Mailtrap::Client`
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,68 +1,91 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
mailtrap (2.
|
|
4
|
+
mailtrap (2.1.1)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
addressable (2.8.
|
|
10
|
-
public_suffix (>= 2.0.2, <
|
|
11
|
-
appraisal (2.
|
|
9
|
+
addressable (2.8.7)
|
|
10
|
+
public_suffix (>= 2.0.2, < 7.0)
|
|
11
|
+
appraisal (2.5.0)
|
|
12
12
|
bundler
|
|
13
13
|
rake
|
|
14
14
|
thor (>= 0.14.0)
|
|
15
15
|
ast (2.4.2)
|
|
16
|
-
|
|
16
|
+
bigdecimal (3.1.8)
|
|
17
|
+
crack (1.0.0)
|
|
18
|
+
bigdecimal
|
|
17
19
|
rexml
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
date (3.3.4)
|
|
21
|
+
diff-lcs (1.5.1)
|
|
22
|
+
hashdiff (1.1.0)
|
|
23
|
+
json (2.7.2)
|
|
24
|
+
language_server-protocol (3.17.0.3)
|
|
25
|
+
mail (2.8.1)
|
|
21
26
|
mini_mime (>= 0.1.1)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
net-imap
|
|
28
|
+
net-pop
|
|
29
|
+
net-smtp
|
|
30
|
+
mini_mime (1.1.5)
|
|
31
|
+
net-imap (0.4.14)
|
|
32
|
+
date
|
|
33
|
+
net-protocol
|
|
34
|
+
net-pop (0.1.2)
|
|
35
|
+
net-protocol
|
|
36
|
+
net-protocol (0.2.2)
|
|
37
|
+
timeout
|
|
38
|
+
net-smtp (0.5.0)
|
|
39
|
+
net-protocol
|
|
40
|
+
parallel (1.25.1)
|
|
41
|
+
parser (3.3.3.0)
|
|
26
42
|
ast (~> 2.4.1)
|
|
27
|
-
|
|
43
|
+
racc
|
|
44
|
+
public_suffix (5.1.1)
|
|
45
|
+
racc (1.8.0)
|
|
28
46
|
rainbow (3.1.1)
|
|
29
|
-
rake (13.
|
|
30
|
-
regexp_parser (2.
|
|
31
|
-
rexml (3.
|
|
32
|
-
rspec (3.
|
|
33
|
-
rspec-core (~> 3.
|
|
34
|
-
rspec-expectations (~> 3.
|
|
35
|
-
rspec-mocks (~> 3.
|
|
36
|
-
rspec-core (3.
|
|
37
|
-
rspec-support (~> 3.
|
|
38
|
-
rspec-expectations (3.
|
|
47
|
+
rake (13.2.1)
|
|
48
|
+
regexp_parser (2.9.2)
|
|
49
|
+
rexml (3.3.9)
|
|
50
|
+
rspec (3.13.0)
|
|
51
|
+
rspec-core (~> 3.13.0)
|
|
52
|
+
rspec-expectations (~> 3.13.0)
|
|
53
|
+
rspec-mocks (~> 3.13.0)
|
|
54
|
+
rspec-core (3.13.0)
|
|
55
|
+
rspec-support (~> 3.13.0)
|
|
56
|
+
rspec-expectations (3.13.1)
|
|
39
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
-
rspec-support (~> 3.
|
|
58
|
+
rspec-support (~> 3.13.0)
|
|
41
59
|
rspec-its (1.3.0)
|
|
42
60
|
rspec-core (>= 3.0.0)
|
|
43
61
|
rspec-expectations (>= 3.0.0)
|
|
44
|
-
rspec-mocks (3.
|
|
62
|
+
rspec-mocks (3.13.1)
|
|
45
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-support (3.
|
|
48
|
-
rubocop (1.
|
|
64
|
+
rspec-support (~> 3.13.0)
|
|
65
|
+
rspec-support (3.13.1)
|
|
66
|
+
rubocop (1.64.1)
|
|
67
|
+
json (~> 2.3)
|
|
68
|
+
language_server-protocol (>= 3.17.0)
|
|
49
69
|
parallel (~> 1.10)
|
|
50
|
-
parser (>= 3.
|
|
70
|
+
parser (>= 3.3.0.2)
|
|
51
71
|
rainbow (>= 2.2.2, < 4.0)
|
|
52
72
|
regexp_parser (>= 1.8, < 3.0)
|
|
53
73
|
rexml (>= 3.2.5, < 4.0)
|
|
54
|
-
rubocop-ast (>= 1.
|
|
74
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
55
75
|
ruby-progressbar (~> 1.7)
|
|
56
|
-
unicode-display_width (>=
|
|
57
|
-
rubocop-ast (1.
|
|
58
|
-
parser (>= 3.
|
|
59
|
-
rubocop-
|
|
60
|
-
rubocop (~> 1.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
77
|
+
rubocop-ast (1.31.3)
|
|
78
|
+
parser (>= 3.3.1.0)
|
|
79
|
+
rubocop-rake (0.6.0)
|
|
80
|
+
rubocop (~> 1.0)
|
|
81
|
+
rubocop-rspec (3.0.2)
|
|
82
|
+
rubocop (~> 1.61)
|
|
83
|
+
ruby-progressbar (1.13.0)
|
|
84
|
+
thor (1.3.1)
|
|
85
|
+
timeout (0.4.1)
|
|
86
|
+
unicode-display_width (2.5.0)
|
|
87
|
+
vcr (6.2.0)
|
|
88
|
+
webmock (3.23.1)
|
|
66
89
|
addressable (>= 2.8.0)
|
|
67
90
|
crack (>= 0.3.2)
|
|
68
91
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -79,9 +102,10 @@ DEPENDENCIES
|
|
|
79
102
|
rspec (~> 3.0)
|
|
80
103
|
rspec-its
|
|
81
104
|
rubocop (~> 1.21)
|
|
105
|
+
rubocop-rake
|
|
82
106
|
rubocop-rspec
|
|
83
107
|
vcr
|
|
84
108
|
webmock
|
|
85
109
|
|
|
86
110
|
BUNDLED WITH
|
|
87
|
-
2.
|
|
111
|
+
2.5.14
|
data/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
[](https://github.com/railsware/mailtrap-ruby/actions/workflows/main.yml)
|
|
2
|
+
[](https://rubydoc.info/gems/mailtrap)
|
|
3
|
+
[](https://rubygems.org/gems/mailtrap)
|
|
4
|
+
[](https://rubygems.org/gems/mailtrap)
|
|
5
|
+
|
|
6
|
+
|
|
2
7
|
|
|
3
8
|
# Official Mailtrap Ruby client
|
|
4
9
|
|
|
@@ -26,7 +31,17 @@ Or install it yourself as:
|
|
|
26
31
|
|
|
27
32
|
## Usage
|
|
28
33
|
|
|
29
|
-
###
|
|
34
|
+
### Ruby on Rails
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
# place this code in config/environments/production.rb:
|
|
38
|
+
config.action_mailer.delivery_method = :mailtrap
|
|
39
|
+
|
|
40
|
+
# then set the MAILTRAP_API_KEY environment variable
|
|
41
|
+
# using your hosting solution.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Pure Ruby
|
|
30
45
|
|
|
31
46
|
```ruby
|
|
32
47
|
require 'mailtrap'
|
|
@@ -46,7 +61,7 @@ client = Mailtrap::Client.new(api_key: 'your-api-key')
|
|
|
46
61
|
client.send(mail)
|
|
47
62
|
```
|
|
48
63
|
|
|
49
|
-
Refer to the [`examples`](examples) folder for
|
|
64
|
+
Refer to the [`examples`](examples) folder for more examples.
|
|
50
65
|
|
|
51
66
|
- [Full](examples/full.rb)
|
|
52
67
|
- [Email template](examples/email_template.rb)
|
|
@@ -55,15 +70,15 @@ Refer to the [`examples`](examples) folder for other examples.
|
|
|
55
70
|
### Content-Transfer-Encoding
|
|
56
71
|
|
|
57
72
|
`mailtrap` gem uses Mailtrap API to send emails. Mailtrap API does not try to
|
|
58
|
-
replicate SMTP. That is why you should expect some limitations when it comes to
|
|
73
|
+
replicate SMTP. That is why you should expect some limitations when it comes to
|
|
59
74
|
sending. For example, `/api/send` endpoint ignores `Content-Transfer-Encoding`
|
|
60
75
|
(see `headers` in the [API documentation](https://railsware.stoplight.io/docs/mailtrap-api-docs/67f1d70aeb62c-send-email)).
|
|
61
|
-
Meaning your recipients will receive emails only in the default encoding which
|
|
76
|
+
Meaning your recipients will receive emails only in the default encoding which
|
|
62
77
|
is `quoted-printable`, if you send with Mailtrap API.
|
|
63
78
|
|
|
64
|
-
For those who does need to use `7bit` or any other encoding, SMTP provides
|
|
65
|
-
better flexibility in that regard. Go to your _Mailtrap account_ → _Email Sending_
|
|
66
|
-
→ _Sending Domains_ → _Your domain_ → _SMTP/API Settings_ to find the SMTP
|
|
79
|
+
For those who does need to use `7bit` or any other encoding, SMTP provides
|
|
80
|
+
better flexibility in that regard. Go to your _Mailtrap account_ → _Email Sending_
|
|
81
|
+
→ _Sending Domains_ → _Your domain_ → _SMTP/API Settings_ to find the SMTP
|
|
67
82
|
configuration example.
|
|
68
83
|
|
|
69
84
|
## Migration guide v1 → v2
|
data/lib/mailtrap/attachment.rb
CHANGED
data/lib/mailtrap/mail.rb
CHANGED
|
@@ -8,9 +8,9 @@ require_relative 'mail/from_template'
|
|
|
8
8
|
module Mailtrap
|
|
9
9
|
module Mail
|
|
10
10
|
class << self
|
|
11
|
-
def from_message(message) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
11
|
+
def from_message(message) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
12
12
|
Mailtrap::Mail::Base.new(
|
|
13
|
-
from:
|
|
13
|
+
from: prepare_addresses(address_list(message['from'])&.addresses).first,
|
|
14
14
|
to: prepare_addresses(address_list(message['to'])&.addresses),
|
|
15
15
|
cc: prepare_addresses(address_list(message['cc'])&.addresses),
|
|
16
16
|
bcc: prepare_addresses(address_list(message['bcc'])&.addresses),
|
|
@@ -26,7 +26,7 @@ module Mailtrap
|
|
|
26
26
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
SPECIAL_HEADERS = %w[
|
|
30
30
|
from
|
|
31
31
|
to
|
|
32
32
|
cc
|
|
@@ -37,6 +37,19 @@ module Mailtrap
|
|
|
37
37
|
contenttype
|
|
38
38
|
].freeze
|
|
39
39
|
|
|
40
|
+
# ActionMailer adds these headers by calling `Mail::Message#encoded`,
|
|
41
|
+
# as if the message is to be delivered via SMTP.
|
|
42
|
+
# Since the message will actually be generated on the Mailtrap side from its components,
|
|
43
|
+
# the headers are redundant and potentially conflicting, so we remove them.
|
|
44
|
+
ACTIONMAILER_ADDED_HEADERS = %w[
|
|
45
|
+
contenttransferencoding
|
|
46
|
+
date
|
|
47
|
+
messageid
|
|
48
|
+
mimeversion
|
|
49
|
+
].freeze
|
|
50
|
+
|
|
51
|
+
HEADERS_TO_REMOVE = (SPECIAL_HEADERS + ACTIONMAILER_ADDED_HEADERS).freeze
|
|
52
|
+
|
|
40
53
|
def address_list(header)
|
|
41
54
|
header.respond_to?(:element) ? header.element : header&.address_list
|
|
42
55
|
end
|
|
@@ -48,7 +61,7 @@ module Mailtrap
|
|
|
48
61
|
def prepare_headers(message)
|
|
49
62
|
message
|
|
50
63
|
.header_fields
|
|
51
|
-
.reject { |header|
|
|
64
|
+
.reject { |header| HEADERS_TO_REMOVE.include?(header.name.downcase.delete('-')) }
|
|
52
65
|
.to_h { |header| [header.name, header.value] }
|
|
53
66
|
.compact
|
|
54
67
|
end
|
data/lib/mailtrap/version.rb
CHANGED
data/mailtrap.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = 'Official mailtrap.io API client'
|
|
13
13
|
spec.homepage = 'https://github.com/railsware/mailtrap-ruby'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '>=
|
|
15
|
+
spec.required_ruby_version = '>= 3.0.0'
|
|
16
16
|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
18
|
spec.metadata['source_code_uri'] = 'https://github.com/railsware/mailtrap-ruby'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailtrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Railsware Products Studio LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Official mailtrap.io API client
|
|
14
14
|
email:
|
|
@@ -19,7 +19,6 @@ extra_rdoc_files: []
|
|
|
19
19
|
files:
|
|
20
20
|
- ".rspec"
|
|
21
21
|
- ".rubocop.yml"
|
|
22
|
-
- ".ruby-version"
|
|
23
22
|
- Appraisals
|
|
24
23
|
- CHANGELOG.md
|
|
25
24
|
- CODE_OF_CONDUCT.md
|
|
@@ -56,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
56
55
|
requirements:
|
|
57
56
|
- - ">="
|
|
58
57
|
- !ruby/object:Gem::Version
|
|
59
|
-
version:
|
|
58
|
+
version: 3.0.0
|
|
60
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements:
|
|
62
61
|
- - ">="
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.7.6
|