smtp-patch 0.0.1 → 0.0.2

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: fda89dbbfdc330f47a98924e6c912f5c0cd70e1e7325f71add9226e91ebedfc8
4
- data.tar.gz: 52b341e7555fb6de4ef9e08b13d982698a764dd2135dc1be192509efc9b9a067
3
+ metadata.gz: d9a236576a470e62f3c55419720b537f2934229c54d420ae2ac83753a93aa953
4
+ data.tar.gz: d45e7ee02959c8a98000043641276c56f3d7ef634e8612573dab70be3972e399
5
5
  SHA512:
6
- metadata.gz: 92cf932ae0dc3fd308bcb370c74cf4778ded8b4ab0e8f84d287603a8daa88fde124140221c4ede92e500042fd642ef9419e38e5c7616e2b1d2898925a75d59e6
7
- data.tar.gz: 476743b9eb393a1616e12e36bf9a6e79a31e853f5e7ad7755c417e8bfdd4bc5252c3fd426f5547ded52e41096d817b3ba63821526e31e21524f43174057db1ed
6
+ metadata.gz: 3dc1735f637de4c0c4eb21a5200835b9b6b5bd3133969cf537cbc403db912a2a44d944cf0348a0000202876ecedc98ef49fe3325dc024efe0732ec35fbb24681
7
+ data.tar.gz: e31b44db4091fc9f11670d91f61c200eb04af65eabd15f6b4948248ea705549710d0a9680136b8fd92194919cee36bfa1a3791ca77704402b13a8da97b8ca89a
data/.gitignore CHANGED
@@ -7,5 +7,8 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ *.gem
11
+
10
12
  # rspec failure tracking
11
13
  .rspec_status
14
+ .DS_Store
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## SMTP Patch
2
2
 
3
- Enhance Ruby net/smtp library to support never interrupted by errors while mail sending to multiple receptions.
3
+ Enhance Ruby net/smtp library to be never interrupted by errors while mail sending to multiple recipients.
4
4
 
5
5
  ### Installation
6
6
 
@@ -14,7 +14,7 @@ Install the gem with bundler:
14
14
 
15
15
  ## Usage
16
16
 
17
- By default, the mail will always be sent when you are sending a mail to multiple receiptions. However, during the sending, if there are errors happened, the errors will not raise at once but raise after email sent out. You can catch the errors like below:
17
+ By default, the mail will always be sent when you are sending a mail to multiple recipients. However, during the sending, if there are errors happened, the errors will not raise at once but raise after email sent out. You can catch the errors like below:
18
18
 
19
19
  ```ruby
20
20
  begin
@@ -0,0 +1,39 @@
1
+ module Net
2
+ class SMTPErrors < ProtoAuthError
3
+ include SMTPError
4
+
5
+ attr_reader :errors
6
+
7
+ def initialize(errors)
8
+ @errors = errors
9
+ super message
10
+ end
11
+
12
+ def message
13
+ "failed to deliver for #{errors}."
14
+ end
15
+ end
16
+
17
+ class SMTP
18
+ alias original_rcptto_list rcptto_list
19
+
20
+ def rcptto_list(to_addrs)
21
+ raise ArgumentError, 'mail destination not given' if to_addrs.empty?
22
+ ok_users = []
23
+ errors = {}
24
+ to_addrs.flatten.each do |addr|
25
+ begin
26
+ rcptto addr
27
+ rescue SMTPError
28
+ errors[addr] = $!
29
+ else
30
+ ok_users << addr
31
+ end
32
+ end
33
+ raise ArgumentError, 'mail destination not given' if ok_users.empty?
34
+ ret = yield
35
+ raise SMTPErrors, errors if errors.any?
36
+ ret
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module SmtpPatch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/smtp-patch.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Charles Koyeung"]
10
10
  spec.email = ["cenxky@gmail.com"]
11
11
 
12
- spec.summary = "Enhance Ruby net/smtp library to support never interrupted by errors while mail sending to multiple receptions."
13
- spec.description = "Enhance Ruby net/smtp library to support never interrupted by errors while mail sending to multiple receptions."
12
+ spec.summary = "Enhance Ruby net/smtp library to be never interrupted by errors while mail sending to multiple recipients."
13
+ spec.description = "Enhance Ruby net/smtp library to be never interrupted by errors while mail sending to multiple recipients."
14
14
  spec.homepage = "https://github.com/cenxky/smtp-patch"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtp-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Koyeung
@@ -52,8 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: Enhance Ruby net/smtp library to support never interrupted by errors
56
- while mail sending to multiple receptions.
55
+ description: Enhance Ruby net/smtp library to be never interrupted by errors while
56
+ mail sending to multiple recipients.
57
57
  email:
58
58
  - cenxky@gmail.com
59
59
  executables: []
@@ -70,6 +70,7 @@ files:
70
70
  - bin/console
71
71
  - bin/setup
72
72
  - lib/smtp/patch.rb
73
+ - lib/smtp/patch/smtp.rb
73
74
  - lib/smtp/patch/version.rb
74
75
  - smtp-patch.gemspec
75
76
  homepage: https://github.com/cenxky/smtp-patch
@@ -94,6 +95,6 @@ requirements: []
94
95
  rubygems_version: 3.0.3
95
96
  signing_key:
96
97
  specification_version: 4
97
- summary: Enhance Ruby net/smtp library to support never interrupted by errors while
98
- mail sending to multiple receptions.
98
+ summary: Enhance Ruby net/smtp library to be never interrupted by errors while mail
99
+ sending to multiple recipients.
99
100
  test_files: []