net-receiver 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +1 -1
- data/lib/net/receiver.rb +17 -9
- data/lib/net/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57dd413a29c66bd22d3180358883ec568e373c28
|
4
|
+
data.tar.gz: 4bb6ee9f711267d8b21c541c6436a04729c3c2d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb7ccee9c50eb0d09e55eca0a4f7c6f9fa5a45d975c0d3393d48a62b5dc622a7d77cba6c5ad9d3625c9e1d347f1634986588c2c075319b565ab62e67b3e80e3
|
7
|
+
data.tar.gz: 0bc5705a43c46d1200130385e787a448b10af74431ed38767f30339b999c960a94de3cf4a8ec23aedb3f42597be91798e1d0a161f245af9d05eb97c514ff1f67
|
data/CHANGELOG.md
CHANGED
@@ -1,2 +1,17 @@
|
|
1
|
-
# v1.0
|
1
|
+
# v1.1.0
|
2
|
+
Changed the defaults for :sender_mx_check and recipient_mx_check to true because the cost is low and we need to know if the sender has a mail server (remote-->local), or if the recipient has a mail server (local-->remote). You can still turn off these checks, if you don't want them.
|
3
|
+
|
4
|
+
In `psych_value`, added a test for "MAIL FROM: <>" (a bounce message). In the case this address is detected, the special value "<>" is passed back from psych_value in :url, and no :domain is created. (In other words, test for `:url=>"<>"` first.)
|
5
|
+
|
6
|
+
````ruby
|
7
|
+
:mailfrom=>{
|
8
|
+
:value=>"<>",
|
9
|
+
:name=>"",
|
10
|
+
:url=>"<>"
|
11
|
+
},
|
12
|
+
````
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
# v1.0.0
|
2
17
|
This is the initial load of the gem. If you find a problem, report it to me at mjwelchphd@gmail.com, or FORK the library, fix the bug, then add a Pull Request.
|
data/README.md
CHANGED
@@ -166,7 +166,7 @@ In this example, `def mail_from` overrides the method of the same name in Receiv
|
|
166
166
|
:sender_character_check | true | This makes `receiver` test for legal characters on the MAIL FROM address.
|
167
167
|
:recipient_character_check | false | This makes `receiver`test for legal characters on the RCPT TO address.
|
168
168
|
:sender_mx_check | true | Tries to obtain the MX name and IP from the DNS for MAIL FROM.
|
169
|
-
:recipient_mx_check |
|
169
|
+
:recipient_mx_check | true | Tries to obtain the MX name and IP from the DNS for RCPT TO.
|
170
170
|
:max_failed_msgs_per_period | 3 | I use this to say, "after 3 failed attempts, lock out the sender for s short period of time (10 minutes in my case)."
|
171
171
|
|
172
172
|
I may add more defaults to this list in the future, but I'll try to make them generalized, so they fit anyone's need.
|
data/lib/net/receiver.rb
CHANGED
@@ -66,8 +66,8 @@ module Net
|
|
66
66
|
def initialize(connection, options)
|
67
67
|
@connection = connection
|
68
68
|
@option_list = [[:ehlo_validation_check, false], [:sender_character_check, true],
|
69
|
-
[:recipient_character_check,
|
70
|
-
[:recipient_mx_check,
|
69
|
+
[:recipient_character_check, true], [:sender_mx_check, true],
|
70
|
+
[:recipient_mx_check, true],[:max_failed_msgs_per_period,3]]
|
71
71
|
@options = options
|
72
72
|
@option_list.each do |key,value|
|
73
73
|
@options[key] = value if !options.has_key?(key)
|
@@ -87,7 +87,7 @@ module Net
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def write_text(text, echo)
|
90
|
-
puts "<#{@enc_ind} #{text.inspect}"
|
90
|
+
puts "<#{@enc_ind} #{text.inspect}" # DEBUG!
|
91
91
|
@connection.write(text)
|
92
92
|
@connection.write(CRLF)
|
93
93
|
@has_level_5_warnings = true if text[0]=='5'
|
@@ -133,17 +133,17 @@ puts "<#{@enc_ind} #{text.inspect}"
|
|
133
133
|
text = "SLAM"
|
134
134
|
end
|
135
135
|
LOG.info("%06d"%Process::pid) {" #{@enc_ind}> #{text}"} if echo && LogConversation
|
136
|
-
puts " #{@enc_ind}> #{text.inspect}"
|
136
|
+
puts " #{@enc_ind}> #{text.inspect}" # DEBUG!
|
137
137
|
return text
|
138
138
|
end
|
139
139
|
rescue Errno::EIO => e
|
140
140
|
LOG.error("%06d"%Process::pid) {"#{e.to_s}"}
|
141
141
|
raise Quit
|
142
142
|
rescue Timeout::Error => e
|
143
|
-
puts " #{@enc_ind}> \"TIMEOUT\""
|
143
|
+
puts " #{@enc_ind}> \"TIMEOUT\"" # DEBUG!
|
144
144
|
return "TIMEOUT"
|
145
145
|
end
|
146
|
-
puts " #{@enc_ind}> *669* Investigate why this got here"
|
146
|
+
puts " #{@enc_ind}> *669* Investigate why this got here" # DEBUG!
|
147
147
|
end
|
148
148
|
|
149
149
|
#-------------------------------------------------------#
|
@@ -153,9 +153,17 @@ puts " #{@enc_ind}> *669* Investigate why this got here"
|
|
153
153
|
# the value gets set in both MAIL FROM and RCPT TO
|
154
154
|
part[:value] = value
|
155
155
|
|
156
|
-
#
|
157
|
-
|
158
|
-
|
156
|
+
# check for a bounce message
|
157
|
+
case
|
158
|
+
when (kind==:mailfrom) & (m = value.match(/^(.*)<>$/))
|
159
|
+
# it's a bounce message
|
160
|
+
part[:name] = m[1].strip
|
161
|
+
part[:url] = "<>"
|
162
|
+
return nil
|
163
|
+
when (m = value.match(/^(.*)<(.+@.+\..+)>$/)).nil?
|
164
|
+
# there MUST be a sender/recipient address
|
165
|
+
return "501 5.1.7 '#{part[:value]}' No proper address (<...>) on the #{Kind[kind]} line" \
|
166
|
+
end
|
159
167
|
|
160
168
|
# break up the address
|
161
169
|
part[:name] = m[1].strip
|
data/lib/net/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-receiver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael J. Welch, Ph.D.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby Net Receiver.
|
14
14
|
email:
|