mailhandler 1.0.57 → 1.0.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +43 -0
- data/LICENSE +2 -2
- data/lib/mailhandler/extensions/mail/smtp.rb +22 -0
- data/lib/mailhandler/sending/api.rb +1 -1
- data/lib/mailhandler/sending/smtp.rb +4 -13
- data/lib/mailhandler/version.rb +1 -1
- data/mailhandler.gemspec +2 -2
- data/postmark.png +0 -0
- data/readme.md +6 -4
- data/spec/unit/mailhandler/sending/sender_api_batch_spec.rb +1 -1
- data/spec/unit/mailhandler/sending/sender_api_spec.rb +1 -1
- data/spec/unit/mailhandler/sending/sender_smtp_spec.rb +1 -1
- metadata +7 -5
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8030c60b3dadc77214d7a1bfc8c5bc475a3665586b22d01b1a0973c8386de30f
|
4
|
+
data.tar.gz: 5c782690c6dc90db551254b3e3e8ab007717b15961143b0d9a6251a0f34a2731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61717a2295a6cfe5f6d961fa9dbffae6f0e6e77a2fe93f667a4838cd55cebb3dba6835182d6d9f41b1f7032afcb146e25db05f97503486e0dfe06f3184dc416
|
7
|
+
data.tar.gz: 1fb736635cf0608cd3d438598ef1c5f0aa1d1c6f60a7b1bcde6b61a840b30512e72ccb3f7686ad0d685317e663ee7a5bd558a9e63c9db2419f67d48a4af1743d
|
@@ -0,0 +1,43 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
workflows:
|
4
|
+
ruby-tests:
|
5
|
+
jobs:
|
6
|
+
- unit-tests:
|
7
|
+
name: ruby24
|
8
|
+
version: "2.4.6"
|
9
|
+
- unit-tests:
|
10
|
+
name: ruby25
|
11
|
+
version: "2.5.5"
|
12
|
+
requires:
|
13
|
+
- ruby24
|
14
|
+
- unit-tests:
|
15
|
+
name: ruby27
|
16
|
+
version: "2.7.5"
|
17
|
+
requires:
|
18
|
+
- ruby25
|
19
|
+
- unit-tests:
|
20
|
+
name: ruby30
|
21
|
+
version: "3.0.0"
|
22
|
+
requires:
|
23
|
+
- ruby27
|
24
|
+
|
25
|
+
jobs:
|
26
|
+
unit-tests:
|
27
|
+
parameters:
|
28
|
+
version:
|
29
|
+
type: string
|
30
|
+
docker:
|
31
|
+
- image: cimg/ruby:<< parameters.version >>
|
32
|
+
steps:
|
33
|
+
- checkout
|
34
|
+
- run:
|
35
|
+
name: Versions
|
36
|
+
command: |
|
37
|
+
echo "ruby: $(ruby --version)"
|
38
|
+
- run:
|
39
|
+
name: Install dependencies
|
40
|
+
command: bundle install
|
41
|
+
- run:
|
42
|
+
name: Run tests
|
43
|
+
command: bundle exec rspec
|
data/LICENSE
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Mail
|
2
|
+
# wrapper methods to support sending raw email, where recipient and sender can be custom
|
3
|
+
class SMTP
|
4
|
+
def deliver_raw!(raw_source_email, smtp_from, smtp_to)
|
5
|
+
response = start_smtp_session do |smtp|
|
6
|
+
Mail::SMTPConnection.new(:connection => smtp, :return_response => true).
|
7
|
+
deliver_raw!(raw_source_email, smtp_from, smtp_to)
|
8
|
+
end
|
9
|
+
|
10
|
+
settings[:return_response] ? response : self
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# wrapper methods to support sending raw email, where recipient and sender can be custom
|
15
|
+
class SMTPConnection
|
16
|
+
def deliver_raw!(raw_source_email, smtp_from, smtp_to)
|
17
|
+
response = smtp.sendmail(dot_stuff(raw_source_email), smtp_from, smtp_to)
|
18
|
+
|
19
|
+
settings[:return_response] ? response : self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
+
require_relative "../extensions/mail/smtp"
|
4
5
|
|
5
6
|
module MailHandler
|
6
7
|
module Sending
|
@@ -22,7 +23,7 @@ module MailHandler
|
|
22
23
|
def initialize
|
23
24
|
@type = :smtp
|
24
25
|
@authentication = 'plain'
|
25
|
-
@use_ssl =
|
26
|
+
@use_ssl = true
|
26
27
|
@save_response = true
|
27
28
|
|
28
29
|
@open_timeout = 60
|
@@ -36,10 +37,8 @@ module MailHandler
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def send_raw_email(text_email, smtp_from, smtp_to)
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
40
|
+
# use same settings as when sending mail created with Mail gem
|
41
|
+
response = Mail::SMTP.new(delivery_options).deliver_raw!(text_email, smtp_from, smtp_to)
|
43
42
|
save_response ? response : nil
|
44
43
|
end
|
45
44
|
|
@@ -54,14 +53,6 @@ module MailHandler
|
|
54
53
|
|
55
54
|
private
|
56
55
|
|
57
|
-
def init_net_smtp
|
58
|
-
sending = Net::SMTP.new(address, port)
|
59
|
-
sending.read_timeout = read_timeout
|
60
|
-
sending.open_timeout = open_timeout
|
61
|
-
sending.enable_starttls_auto if use_ssl
|
62
|
-
sending
|
63
|
-
end
|
64
|
-
|
65
56
|
def configure_sending(email)
|
66
57
|
email.delivery_method :smtp, delivery_options
|
67
58
|
email
|
data/lib/mailhandler/version.rb
CHANGED
data/mailhandler.gemspec
CHANGED
@@ -11,14 +11,14 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.license = 'MIT'
|
12
12
|
|
13
13
|
s.authors = ['Igor Balos']
|
14
|
-
s.email = ['ibalosh@gmail.com', '
|
14
|
+
s.email = ['ibalosh@gmail.com', 'ibalos@activecampaign.com']
|
15
15
|
|
16
16
|
s.summary = 'Postmark email receiving and sending handler.'
|
17
17
|
s.description = 'Use this gem to send emails through SMTP and Postmark API and check if email arrived.'
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
20
20
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
|
-
s.homepage = 'https://github.com/
|
21
|
+
s.homepage = 'https://github.com/ActiveCampaign/mailhandler'
|
22
22
|
s.require_paths = ['lib']
|
23
23
|
|
24
24
|
s.post_install_message = '
|
data/postmark.png
ADDED
Binary file
|
data/readme.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
<
|
1
|
+
<a href="https://postmarkapp.com">
|
2
|
+
<img src="postmark.png" alt="Postmark Logo" title="Postmark" width="120" height="120" align="right">
|
3
|
+
</a>
|
2
4
|
|
3
5
|
# MailHandler Gem
|
4
6
|
|
5
|
-
[![Build Status](https://
|
7
|
+
[![Build Status](https://circleci.com/gh/ActiveCampaign/mailhandler.svg?style=shield)](https://circleci.com/gh/ActiveCampaign/mailhandler)
|
6
8
|
|
7
|
-
MailHandler is a simple wrapper on top of [Mail gem](https://github.com/mikel/mail) and [Postmark gem](https://github.com/
|
9
|
+
MailHandler is a simple wrapper on top of [Mail gem](https://github.com/mikel/mail) and [Postmark gem](https://github.com/ActiveCampaign/postmark-gem) libraries. It allows you to send and retrieve emails and at the same time get details on how long these operations took.
|
8
10
|
Main purpose of the gem is easier email sending/delivery testing with notification option if sending or retrieving email is taking too long.
|
9
11
|
|
10
12
|
The library supports sending email by standard SMTP protocol and by Postmark API. More importantly it also allows checking email delivery by IMAP protocol, or by folder if you have a local mailbox.
|
@@ -195,7 +197,7 @@ Once email sending is finished, you can check sending result by looking at: `ema
|
|
195
197
|
|
196
198
|
### License
|
197
199
|
|
198
|
-
MailHandler Library is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form") license. Refere to the [LICENSE](https://github.com/
|
200
|
+
MailHandler Library is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form") license. Refere to the [LICENSE](https://github.com/ActiveCampaign/mailhandler/blob/master/LICENSE) file for more information.
|
199
201
|
|
200
202
|
|
201
203
|
|
@@ -13,7 +13,7 @@ describe MailHandler::Sending::PostmarkBatchAPISender do
|
|
13
13
|
aggregate_failures 'init details' do
|
14
14
|
expect(sender.api_token).to eq api_token
|
15
15
|
expect(sender.type).to eq :postmark_api
|
16
|
-
expect(sender.use_ssl).to be
|
16
|
+
expect(sender.use_ssl).to be true
|
17
17
|
expect(sender.host).to eq 'api.postmarkapp.com'
|
18
18
|
end
|
19
19
|
end
|
@@ -13,7 +13,7 @@ describe MailHandler::Sending::PostmarkAPISender do
|
|
13
13
|
aggregate_failures 'init details' do
|
14
14
|
expect(sender.api_token).to eq api_token
|
15
15
|
expect(sender.type).to eq :postmark_api
|
16
|
-
expect(sender.use_ssl).to be
|
16
|
+
expect(sender.use_ssl).to be true
|
17
17
|
expect(sender.host).to eq 'api.postmarkapp.com'
|
18
18
|
end
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailhandler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Balos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -42,20 +42,21 @@ description: Use this gem to send emails through SMTP and Postmark API and check
|
|
42
42
|
email arrived.
|
43
43
|
email:
|
44
44
|
- ibalosh@gmail.com
|
45
|
-
-
|
45
|
+
- ibalos@activecampaign.com
|
46
46
|
executables: []
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- ".circleci/config.yml"
|
50
51
|
- ".gitignore"
|
51
52
|
- ".rubocop.yml"
|
52
|
-
- ".travis.yml"
|
53
53
|
- Gemfile
|
54
54
|
- LICENSE
|
55
55
|
- Rakefile
|
56
56
|
- lib/mailhandler.rb
|
57
57
|
- lib/mailhandler/errors.rb
|
58
58
|
- lib/mailhandler/extensions/mail/imap.rb
|
59
|
+
- lib/mailhandler/extensions/mail/smtp.rb
|
59
60
|
- lib/mailhandler/receiver.rb
|
60
61
|
- lib/mailhandler/receiving/base.rb
|
61
62
|
- lib/mailhandler/receiving/filelist/base.rb
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- lib/mailhandler/sending/smtp.rb
|
76
77
|
- lib/mailhandler/version.rb
|
77
78
|
- mailhandler.gemspec
|
79
|
+
- postmark.png
|
78
80
|
- readme.md
|
79
81
|
- spec/data/email-uni1.txt
|
80
82
|
- spec/data/email-uni2.txt
|
@@ -93,7 +95,7 @@ files:
|
|
93
95
|
- spec/unit/mailhandler/sending/sender_api_spec.rb
|
94
96
|
- spec/unit/mailhandler/sending/sender_smtp_spec.rb
|
95
97
|
- spec/unit/mailhandler_spec.rb
|
96
|
-
homepage: https://github.com/
|
98
|
+
homepage: https://github.com/ActiveCampaign/mailhandler
|
97
99
|
licenses:
|
98
100
|
- MIT
|
99
101
|
metadata: {}
|