sisimai 4.24.1-java → 4.25.0-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sisimai might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/ANALYTICAL-PRECISION +16 -25
- data/ChangeLog.md +41 -0
- data/Developers.mk +2 -2
- data/README-JA.md +13 -13
- data/README.md +13 -13
- data/lib/sisimai.rb +3 -7
- data/lib/sisimai/address.rb +25 -41
- data/lib/sisimai/arf.rb +58 -59
- data/lib/sisimai/bite.rb +0 -1
- data/lib/sisimai/bite/email.rb +7 -7
- data/lib/sisimai/bite/email/activehunter.rb +4 -3
- data/lib/sisimai/bite/email/amavis.rb +133 -0
- data/lib/sisimai/bite/email/amazonses.rb +53 -87
- data/lib/sisimai/bite/email/amazonworkmail.rb +51 -57
- data/lib/sisimai/bite/email/aol.rb +50 -76
- data/lib/sisimai/bite/email/apachejames.rb +2 -2
- data/lib/sisimai/bite/email/bigfoot.rb +47 -74
- data/lib/sisimai/bite/email/biglobe.rb +8 -9
- data/lib/sisimai/bite/email/courier.rb +56 -101
- data/lib/sisimai/bite/email/domino.rb +7 -8
- data/lib/sisimai/bite/email/einsundeins.rb +4 -5
- data/lib/sisimai/bite/email/exchange2003.rb +21 -22
- data/lib/sisimai/bite/email/exchange2007.rb +26 -28
- data/lib/sisimai/bite/email/exim.rb +48 -47
- data/lib/sisimai/bite/email/ezweb.rb +24 -36
- data/lib/sisimai/bite/email/facebook.rb +54 -79
- data/lib/sisimai/bite/email/fml.rb +10 -10
- data/lib/sisimai/bite/email/gmx.rb +6 -6
- data/lib/sisimai/bite/email/google.rb +12 -13
- data/lib/sisimai/bite/email/gsuite.rb +80 -108
- data/lib/sisimai/bite/email/imailserver.rb +16 -16
- data/lib/sisimai/bite/email/interscanmss.rb +4 -6
- data/lib/sisimai/bite/email/kddi.rb +9 -11
- data/lib/sisimai/bite/email/mailfoundry.rb +2 -2
- data/lib/sisimai/bite/email/mailmarshalsmtp.rb +2 -2
- data/lib/sisimai/bite/email/mailru.rb +12 -13
- data/lib/sisimai/bite/email/mcafee.rb +31 -25
- data/lib/sisimai/bite/email/messagelabs.rb +48 -87
- data/lib/sisimai/bite/email/messagingserver.rb +9 -10
- data/lib/sisimai/bite/email/mfilter.rb +16 -16
- data/lib/sisimai/bite/email/mxlogic.rb +11 -11
- data/lib/sisimai/bite/email/notes.rb +5 -6
- data/lib/sisimai/bite/email/office365.rb +25 -42
- data/lib/sisimai/bite/email/opensmtpd.rb +8 -8
- data/lib/sisimai/bite/email/outlook.rb +49 -67
- data/lib/sisimai/bite/email/postfix.rb +78 -112
- data/lib/sisimai/bite/email/qmail.rb +23 -23
- data/lib/sisimai/bite/email/receivingses.rb +53 -86
- data/lib/sisimai/bite/email/sendgrid.rb +65 -84
- data/lib/sisimai/bite/email/sendmail.rb +89 -117
- data/lib/sisimai/bite/email/surfcontrol.rb +15 -18
- data/lib/sisimai/bite/email/userdefined.rb +1 -1
- data/lib/sisimai/bite/email/v5sendmail.rb +3 -4
- data/lib/sisimai/bite/email/verizon.rb +7 -8
- data/lib/sisimai/bite/email/x1.rb +2 -2
- data/lib/sisimai/bite/email/x2.rb +2 -2
- data/lib/sisimai/bite/email/x3.rb +3 -3
- data/lib/sisimai/bite/email/x4.rb +22 -22
- data/lib/sisimai/bite/email/x5.rb +40 -49
- data/lib/sisimai/bite/email/yahoo.rb +3 -3
- data/lib/sisimai/bite/email/yandex.rb +54 -82
- data/lib/sisimai/bite/email/zoho.rb +6 -6
- data/lib/sisimai/bite/json/amazonses.rb +20 -20
- data/lib/sisimai/bite/json/sendgrid.rb +2 -2
- data/lib/sisimai/data.rb +27 -40
- data/lib/sisimai/datetime.rb +146 -162
- data/lib/sisimai/mda.rb +30 -31
- data/lib/sisimai/message/email.rb +83 -123
- data/lib/sisimai/message/json.rb +2 -4
- data/lib/sisimai/mime.rb +31 -34
- data/lib/sisimai/order/email.rb +23 -22
- data/lib/sisimai/reason.rb +61 -61
- data/lib/sisimai/reason/blocked.rb +139 -135
- data/lib/sisimai/reason/contenterror.rb +11 -10
- data/lib/sisimai/reason/exceedlimit.rb +4 -4
- data/lib/sisimai/reason/expired.rb +20 -20
- data/lib/sisimai/reason/filtered.rb +19 -18
- data/lib/sisimai/reason/hasmoved.rb +3 -3
- data/lib/sisimai/reason/hostunknown.rb +19 -19
- data/lib/sisimai/reason/mailboxfull.rb +49 -49
- data/lib/sisimai/reason/mailererror.rb +16 -16
- data/lib/sisimai/reason/mesgtoobig.rb +17 -17
- data/lib/sisimai/reason/networkerror.rb +19 -19
- data/lib/sisimai/reason/norelaying.rb +16 -16
- data/lib/sisimai/reason/notaccept.rb +9 -10
- data/lib/sisimai/reason/onhold.rb +1 -1
- data/lib/sisimai/reason/policyviolation.rb +21 -20
- data/lib/sisimai/reason/rejected.rb +53 -53
- data/lib/sisimai/reason/securityerror.rb +29 -29
- data/lib/sisimai/reason/spamdetected.rb +127 -127
- data/lib/sisimai/reason/suspend.rb +17 -17
- data/lib/sisimai/reason/systemerror.rb +22 -21
- data/lib/sisimai/reason/systemfull.rb +6 -6
- data/lib/sisimai/reason/toomanyconn.rb +19 -18
- data/lib/sisimai/reason/userunknown.rb +122 -121
- data/lib/sisimai/reason/vacation.rb +8 -8
- data/lib/sisimai/reason/virusdetected.rb +8 -8
- data/lib/sisimai/rfc1894.rb +142 -0
- data/lib/sisimai/rfc3464.rb +70 -70
- data/lib/sisimai/rfc3834.rb +15 -15
- data/lib/sisimai/rfc5322.rb +20 -36
- data/lib/sisimai/rhost.rb +1 -0
- data/lib/sisimai/rhost/exchangeonline.rb +31 -33
- data/lib/sisimai/rhost/franceptt.rb +23 -23
- data/lib/sisimai/rhost/godaddy.rb +28 -28
- data/lib/sisimai/rhost/googleapps.rb +39 -41
- data/lib/sisimai/rhost/kddi.rb +3 -3
- data/lib/sisimai/rhost/tencentqq.rb +51 -0
- data/lib/sisimai/smtp/error.rb +14 -21
- data/lib/sisimai/smtp/reply.rb +14 -13
- data/lib/sisimai/smtp/status.rb +178 -179
- data/lib/sisimai/string.rb +13 -12
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/README.md +1 -5
- data/set-of-emails/maildir/bsd/arf-23.eml +49 -0
- data/set-of-emails/maildir/bsd/email-amavis-01.eml +78 -0
- data/set-of-emails/maildir/bsd/email-amavis-02.eml +78 -0
- data/set-of-emails/maildir/bsd/email-exchange2007-04.eml +146 -0
- data/set-of-emails/maildir/bsd/email-exim-60.eml +94 -0
- data/set-of-emails/maildir/bsd/email-ezweb-08.eml +49 -0
- data/set-of-emails/maildir/bsd/email-google-19.eml +67 -0
- data/set-of-emails/maildir/bsd/email-mcafee-05.eml +74 -0
- data/set-of-emails/maildir/bsd/email-messagingserver-12.eml +99 -0
- data/set-of-emails/maildir/bsd/email-postfix-46.eml +81 -0
- data/set-of-emails/maildir/bsd/email-postfix-47.eml +79 -0
- data/set-of-emails/maildir/bsd/email-postfix-48.eml +79 -0
- data/set-of-emails/maildir/bsd/email-postfix-49.eml +141 -0
- data/set-of-emails/maildir/bsd/email-postfix-50.eml +143 -0
- data/set-of-emails/maildir/bsd/email-postfix-51.eml +73 -0
- data/set-of-emails/maildir/bsd/email-postfix-52.eml +79 -0
- data/set-of-emails/maildir/bsd/email-postfix-53.eml +76 -0
- data/set-of-emails/maildir/bsd/email-postfix-54.eml +73 -0
- data/set-of-emails/maildir/bsd/email-postfix-55.eml +74 -0
- data/set-of-emails/maildir/bsd/email-postfix-56.eml +78 -0
- data/set-of-emails/maildir/bsd/email-qmail-10.eml +50 -0
- data/set-of-emails/maildir/bsd/email-x2-05.eml +38 -0
- data/set-of-emails/maildir/bsd/rhost-google-apps-02.eml +88 -0
- data/set-of-emails/maildir/bsd/rhost-tencentqq-01.eml +84 -0
- data/set-of-emails/maildir/bsd/rhost-tencentqq-02.eml +84 -0
- data/set-of-emails/maildir/bsd/rhost-tencentqq-03.eml +81 -0
- data/set-of-emails/maildir/dos/email-amavis-01.eml +78 -0
- data/set-of-emails/maildir/dos/email-apachejames-01.eml +1 -2
- data/set-of-emails/maildir/dos/email-messagelabs-01.eml +67 -50
- data/set-of-emails/maildir/dos/email-x4-01.eml +31 -76
- data/set-of-emails/maildir/dos/rhost-tencentqq-01.eml +84 -0
- data/set-of-emails/maildir/mac/email-amavis-01.eml +1 -4
- data/set-of-emails/maildir/mac/email-apachejames-01.eml +1 -9
- data/set-of-emails/maildir/mac/email-messagelabs-01.eml +1 -9
- data/set-of-emails/maildir/mac/email-x4-01.eml +1 -5
- data/set-of-emails/maildir/mac/rhost-tencentqq-01.eml +1 -4
- metadata +35 -4
- data/set-of-emails/logo/horizontalversions.png +0 -0
- data/set-of-emails/logo/icon.png +0 -0
data/lib/sisimai/rhost/kddi.rb
CHANGED
@@ -8,8 +8,8 @@ module Sisimai
|
|
8
8
|
class << self
|
9
9
|
# Imported from p5-Sisimail/lib/Sisimai/Rhost/KDDI.pm
|
10
10
|
MessagesOf = {
|
11
|
-
filtered
|
12
|
-
userunknown
|
11
|
+
'filtered' => '550 : User unknown', # The response was: 550 : User unknown
|
12
|
+
'userunknown' => '>: User unknown', # The response was: 550 <...>: User unknown
|
13
13
|
}.freeze
|
14
14
|
|
15
15
|
# Detect bounce reason from au (KDDI)
|
@@ -22,7 +22,7 @@ module Sisimai
|
|
22
22
|
MessagesOf.each_key do |e|
|
23
23
|
# Try to match the error message with message patterns defined in $MessagesOf
|
24
24
|
next unless statusmesg.end_with?(MessagesOf[e])
|
25
|
-
reasontext = e
|
25
|
+
reasontext = e
|
26
26
|
break
|
27
27
|
end
|
28
28
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Rhost
|
3
|
+
# Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data
|
4
|
+
# object as an argument of get() method when the value of "rhost" of the object
|
5
|
+
# is "mx*.qq.com". This class is called only Sisimai::Data class.
|
6
|
+
module TencentQQ
|
7
|
+
class << self
|
8
|
+
# Imported from p5-Sisimail/lib/Sisimai/Rhost/TencentQQ.pm
|
9
|
+
MessagesOf = {
|
10
|
+
# https://service.mail.qq.com/cgi-bin/help?id=20022
|
11
|
+
'dmarc check failed' => 'blocked',
|
12
|
+
'spf check failed' => 'blocked',
|
13
|
+
'suspected spam ip' => 'blocked',
|
14
|
+
'mail is rejected by recipients' => 'filtered',
|
15
|
+
'message too large' => 'mesgtoobig',
|
16
|
+
'mail content denied' => 'spamdetected',
|
17
|
+
'spam is embedded in the email' => 'spamdetected',
|
18
|
+
'suspected spam' => 'spamdetected',
|
19
|
+
'bad address syntax' => 'syntaxerror',
|
20
|
+
'connection denied' => 'toomanyconn',
|
21
|
+
'connection frequency limited' => 'toomanyconn',
|
22
|
+
'domain frequency limited' => 'toomanyconn',
|
23
|
+
'ip frequency limited' => 'toomanyconn',
|
24
|
+
'sender frequency limited' => 'toomanyconn',
|
25
|
+
'mailbox unavailable or access denied' => 'toomanyconn',
|
26
|
+
'mailbox not found' => 'userunknown',
|
27
|
+
}.freeze
|
28
|
+
|
29
|
+
# Detect bounce reason from Tencent QQ
|
30
|
+
# @param [Sisimai::Data] argvs Parsed email object
|
31
|
+
# @return [String] The bounce reason at Tencent QQ
|
32
|
+
def get(argvs)
|
33
|
+
return argvs.reason unless argvs.reason.empty?
|
34
|
+
|
35
|
+
statusmesg = argvs.diagnosticcode.downcase
|
36
|
+
reasontext = ''
|
37
|
+
|
38
|
+
MessagesOf.each_key do |e|
|
39
|
+
# Try to match the error message with message patterns defined in $MessagesOf
|
40
|
+
next unless statusmesg.include?(e)
|
41
|
+
reasontext = MessagesOf[e]
|
42
|
+
break
|
43
|
+
end
|
44
|
+
return reasontext
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/lib/sisimai/smtp/error.rb
CHANGED
@@ -9,12 +9,12 @@ module Sisimai
|
|
9
9
|
require 'sisimai/smtp/status'
|
10
10
|
|
11
11
|
SoftOrHard = {
|
12
|
-
|
12
|
+
'soft' => %w[
|
13
13
|
blocked contenterror exceedlimit expired filtered mailboxfull
|
14
14
|
mailererror mesgtoobig networkerror norelaying policyviolation
|
15
15
|
rejected securityerror spamdetected suspend syntaxerror systemerror
|
16
16
|
systemfull toomanyconn virusdetected],
|
17
|
-
|
17
|
+
'hard' => %w[hasmoved hostunknown userunknown]
|
18
18
|
}.freeze
|
19
19
|
|
20
20
|
# Permanent error or not
|
@@ -25,11 +25,9 @@ module Sisimai
|
|
25
25
|
# @since v4.17.3
|
26
26
|
def is_permanent(argv1 = '')
|
27
27
|
getchecked = nil
|
28
|
-
statuscode = Sisimai::SMTP::Status.find(argv1)
|
29
|
-
statuscode = Sisimai::SMTP::Reply.find(argv1) if statuscode.empty?
|
30
|
-
classvalue = statuscode[0, 1].to_i
|
28
|
+
statuscode = Sisimai::SMTP::Status.find(argv1) || Sisimai::SMTP::Reply.find(argv1) || '0'
|
31
29
|
|
32
|
-
if classvalue > 0
|
30
|
+
if (classvalue = statuscode[0, 1].to_i) > 0
|
33
31
|
# 2, 4, or 5
|
34
32
|
if classvalue == 5
|
35
33
|
# Permanent error
|
@@ -66,28 +64,23 @@ module Sisimai
|
|
66
64
|
# '': May not be bounce ?
|
67
65
|
# @since v4.17.3
|
68
66
|
def soft_or_hard(argv1 = '', argv2 = '')
|
69
|
-
return
|
70
|
-
|
71
|
-
getchecked = nil
|
72
|
-
softorhard = nil
|
67
|
+
return nil if argv1.empty?
|
68
|
+
value = nil
|
73
69
|
|
74
70
|
if %w[delivered feedback vacation].include?(argv1)
|
75
71
|
# These are not dealt as a bounce reason
|
76
|
-
|
72
|
+
value = ''
|
77
73
|
|
78
74
|
elsif argv1 == 'onhold' || argv1 == 'undefined'
|
79
75
|
# It should be "soft" when a reason is "onhold" or "undefined"
|
80
|
-
|
76
|
+
value = 'soft'
|
81
77
|
|
82
78
|
elsif argv1 == 'notaccept'
|
83
79
|
# NotAccept: 5xx => hard bounce, 4xx => soft bounce
|
84
80
|
if argv2.size > 0
|
85
81
|
# Get D.S.N. or SMTP reply code from The 2nd argument string
|
86
|
-
statuscode = Sisimai::SMTP::Status.find(argv2)
|
87
|
-
|
88
|
-
classvalue = statuscode[0, 1].to_i
|
89
|
-
|
90
|
-
softorhard = if classvalue == 4
|
82
|
+
statuscode = Sisimai::SMTP::Status.find(argv2) || Sisimai::SMTP::Reply.find(argv2) || '0'
|
83
|
+
value = if statuscode[0, 1].to_i == 4
|
91
84
|
# Deal as a "soft bounce"
|
92
85
|
'soft'
|
93
86
|
else
|
@@ -96,19 +89,19 @@ module Sisimai
|
|
96
89
|
end
|
97
90
|
else
|
98
91
|
# "notaccept" is a hard bounce
|
99
|
-
|
92
|
+
value = 'hard'
|
100
93
|
end
|
101
94
|
|
102
95
|
else
|
103
96
|
# Check all the reasons defined at the above
|
104
97
|
catch :SOFT_OR_HARD do
|
105
98
|
while true
|
106
|
-
[
|
99
|
+
%w[hard soft].each do |e|
|
107
100
|
# Soft or Hard?
|
108
101
|
SoftOrHard[e].each do |f|
|
109
102
|
# Hard bounce?
|
110
103
|
next unless argv1 == f
|
111
|
-
|
104
|
+
value = e
|
112
105
|
throw :SOFT_OR_HARD
|
113
106
|
end
|
114
107
|
end
|
@@ -118,7 +111,7 @@ module Sisimai
|
|
118
111
|
end
|
119
112
|
end
|
120
113
|
|
121
|
-
return
|
114
|
+
return value
|
122
115
|
end
|
123
116
|
|
124
117
|
end
|
data/lib/sisimai/smtp/reply.rb
CHANGED
@@ -61,31 +61,32 @@ module Sisimai
|
|
61
61
|
module Reply
|
62
62
|
# Imported from p5-Sisimail/lib/Sisimai/SMTP/Reply.pm
|
63
63
|
class << self
|
64
|
+
IP4Re = %r{\b
|
65
|
+
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
66
|
+
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
67
|
+
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
68
|
+
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])
|
69
|
+
\b}x
|
70
|
+
|
64
71
|
# Get SMTP Reply Code from the given string
|
65
72
|
# @param [String] argv1 String including SMTP Reply Code like 550
|
66
|
-
# @return [String] SMTP Reply Code or
|
73
|
+
# @return [String] SMTP Reply Code or Nil if the first argument
|
67
74
|
# did not include SMTP Reply Code value
|
68
|
-
def find(argv1 =
|
69
|
-
return
|
70
|
-
return
|
71
|
-
return
|
75
|
+
def find(argv1 = nil)
|
76
|
+
return nil unless argv1
|
77
|
+
return nil if argv1.empty?
|
78
|
+
return nil if argv1.upcase.include?('X-UNIX')
|
72
79
|
|
73
80
|
# Convert found IPv4 addresses to '***.***.***.***' to avoid that
|
74
81
|
# the following code detects an octet of the IPv4 adress as an SMTP
|
75
82
|
# reply code.
|
76
|
-
|
77
|
-
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
78
|
-
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
79
|
-
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])[.]
|
80
|
-
(?:\d|[01]?\d\d|2[0-4]\d|25[0-5])
|
81
|
-
\b}x
|
82
|
-
argv1 = argv1.gsub(/#{ip4re}/, '***.***.***.***') if argv1 =~ ip4re
|
83
|
+
argv1 = argv1.gsub(/#{IP4Re}/, '***.***.***.***') if argv1 =~ IP4Re
|
83
84
|
|
84
85
|
if cv = argv1.match(/\b([45][0-5][0-9])\b/) || argv1.match(/\b(25[0-3])\b/)
|
85
86
|
# 550, 447, or 250
|
86
87
|
return cv[1]
|
87
88
|
else
|
88
|
-
return
|
89
|
+
return nil
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
data/lib/sisimai/smtp/status.rb
CHANGED
@@ -540,167 +540,173 @@ module Sisimai
|
|
540
540
|
module Status
|
541
541
|
# Imported from p5-Sisimail/lib/Sisimai/SMTP/Status.pm
|
542
542
|
class << self
|
543
|
+
CodePatterns = [
|
544
|
+
%r/[ ]?[(][#]([45][.]\d[.]\d+)[)]?[ ]?/, # #5.5.1
|
545
|
+
%r/\b\d{3}[- ][#]?([45][.]\d[.]\d+)\b/, # 550-5.1.1 OR 550 5.5.1
|
546
|
+
%r/\b([45][.]\d[.]\d+)\b/, # 5.5.1
|
547
|
+
%r/\b(2[.][0-7][.][0-7])\b/, # 2.1.5
|
548
|
+
]
|
543
549
|
StandardCode = {
|
544
|
-
|
550
|
+
'2.1.5' => 'delivered', # Successfully delivered
|
545
551
|
# ------------------------------------------------------------------------------
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
#
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
#
|
560
|
-
|
561
|
-
|
562
|
-
#
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
#
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
552
|
+
'4.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
|
553
|
+
'4.1.7' => 'rejected', # Bad sender's mailbox address syntax
|
554
|
+
'4.1.8' => 'rejected', # Bad sender's system address
|
555
|
+
'4.1.9' => 'systemerror', # Message relayed to non-compliant mailer
|
556
|
+
'4.2.1' => 'suspend', # Mailbox disabled, not accepting messages
|
557
|
+
'4.2.2' => 'mailboxfull', # Mailbox full
|
558
|
+
'4.2.3' => 'exceedlimit', # Message length exceeds administrative limit
|
559
|
+
'4.2.4' => 'filtered', # Mailing list expansion problem
|
560
|
+
# '4.3.0' => 'systemerror', # Other or undefined mail system status
|
561
|
+
'4.3.1' => 'systemfull', # Mail system full
|
562
|
+
'4.3.2' => 'notaccept', # System not accepting network messages
|
563
|
+
'4.3.3' => 'systemerror', # System not capable of selected features
|
564
|
+
'4.3.5' => 'systemerror', # System incorrectly configured
|
565
|
+
# '4.4.0' => 'networkerror', # Other or undefined network or routing status
|
566
|
+
'4.4.1' => 'expired', # No answer from host
|
567
|
+
'4.4.2' => 'networkerror', # Bad connection
|
568
|
+
# '4.4.3' => 'systemerror', # Directory server failure
|
569
|
+
'4.4.4' => 'networkerror', # Unable to route
|
570
|
+
'4.4.5' => 'systemfull', # Mail system congestion
|
571
|
+
'4.4.6' => 'networkerror', # Routing loop detected
|
572
|
+
'4.4.7' => 'expired', # Delivery time expired
|
573
|
+
# '4.5.0' => 'networkerror', # Other or undefined protocol status
|
574
|
+
'4.5.3' => 'systemerror', # Too many recipients
|
575
|
+
'4.5.5' => 'systemerror', # Wrong protocol version
|
576
|
+
'4.6.0' => 'contenterror', # Other or undefined media error
|
577
|
+
'4.6.2' => 'contenterror', # Conversion required and prohibited
|
578
|
+
'4.6.5' => 'contenterror', # Conversion Failed
|
573
579
|
# :'4.7.0' => 'securityerror', # Other or undefined security status
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
580
|
+
'4.7.1' => 'blocked', # Delivery not authorized, message refused
|
581
|
+
'4.7.2' => 'blocked', # Mailing list expansion prohibited
|
582
|
+
'4.7.5' => 'securityerror', # Cryptographic failure
|
583
|
+
'4.7.6' => 'securityerror', # Cryptographic algorithm not supported
|
584
|
+
'4.7.7' => 'securityerror', # Message integrity failure
|
585
|
+
'4.7.12' => 'securityerror', # A password transition is needed
|
586
|
+
'4.7.15' => 'securityerror', # Priority Level is too low
|
587
|
+
'4.7.16' => 'mesgtoobig', # Message is too big for the specified priority
|
588
|
+
'4.7.24' => 'securityerror', # SPF validation error
|
589
|
+
'4.7.25' => 'blocked', # Reverse DNS validation failed
|
584
590
|
# ------------------------------------------------------------------------------
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
591
|
+
'5.1.0' => 'userunknown', # Other address status
|
592
|
+
'5.1.1' => 'userunknown', # Bad destination mailbox address
|
593
|
+
'5.1.2' => 'hostunknown', # Bad destination system address
|
594
|
+
'5.1.3' => 'userunknown', # Bad destination mailbox address syntax
|
595
|
+
'5.1.4' => 'filtered', # Destination mailbox address ambiguous
|
596
|
+
'5.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
|
597
|
+
'5.1.7' => 'rejected', # Bad sender's mailbox address syntax
|
598
|
+
'5.1.8' => 'rejected', # Bad sender's system address
|
599
|
+
'5.1.9' => 'systemerror', # Message relayed to non-compliant mailer
|
600
|
+
'5.1.10' => 'notaccept', # Recipient address has null MX
|
601
|
+
'5.2.0' => 'filtered', # Other or undefined mailbox status
|
602
|
+
'5.2.1' => 'filtered', # Mailbox disabled, not accepting messages
|
603
|
+
'5.2.2' => 'mailboxfull', # Mailbox full
|
604
|
+
'5.2.3' => 'exceedlimit', # Message length exceeds administrative limit
|
605
|
+
'5.2.4' => 'filtered', # Mailing list expansion problem
|
606
|
+
'5.3.0' => 'systemerror', # Other or undefined mail system status
|
607
|
+
'5.3.1' => 'systemfull', # Mail system full
|
608
|
+
'5.3.2' => 'notaccept', # System not accepting network messages
|
609
|
+
'5.3.3' => 'systemerror', # System not capable of selected features
|
610
|
+
'5.3.4' => 'mesgtoobig', # Message too big for system
|
611
|
+
'5.3.5' => 'systemerror', # System incorrectly configured
|
612
|
+
'5.4.0' => 'networkerror', # Other or undefined network or routing status
|
613
|
+
'5.4.3' => 'systemerror', # Directory server failure
|
614
|
+
'5.4.4' => 'hostunknown', # Unable to route
|
615
|
+
'5.5.3' => 'toomanyconn', # Too many recipients
|
616
|
+
'5.5.4' => 'systemerror', # Invalid command arguments
|
617
|
+
'5.5.5' => 'systemerror', # Wrong protocol version
|
618
|
+
'5.5.6' => 'securityerror', # Authentication Exchange line is too long
|
619
|
+
'5.6.0' => 'contenterror', # Other or undefined media error
|
620
|
+
'5.6.1' => 'contenterror', # Media not supported
|
621
|
+
'5.6.2' => 'contenterror', # Conversion required and prohibited
|
622
|
+
'5.6.3' => 'contenterror', # Conversion required but not supported
|
623
|
+
'5.6.5' => 'contenterror', # Conversion Failed
|
624
|
+
'5.6.6' => 'contenterror', # Message content not available
|
625
|
+
'5.6.7' => 'contenterror', # Non-ASCII addresses not permitted for that sender/recipient
|
626
|
+
'5.6.8' => 'contenterror', # UTF-8 string reply is required, but not permitted by the SMTP client
|
627
|
+
'5.6.9' => 'contenterror', # UTF-8 header message cannot be transferred to one or more recipients
|
628
|
+
'5.7.0' => 'securityerror', # Other or undefined security status
|
629
|
+
'5.7.1' => 'securityerror', # Delivery not authorized, message refused
|
630
|
+
'5.7.2' => 'securityerror', # Mailing list expansion prohibited
|
631
|
+
'5.7.3' => 'securityerror', # Security conversion required but not possible
|
632
|
+
'5.7.4' => 'securityerror', # Security features not supported
|
633
|
+
'5.7.5' => 'securityerror', # Cryptographic failure
|
634
|
+
'5.7.6' => 'securityerror', # Cryptographic algorithm not supported
|
635
|
+
'5.7.7' => 'securityerror', # Message integrity failure
|
636
|
+
'5.7.8' => 'securityerror', # Authentication credentials invalid
|
637
|
+
'5.7.9' => 'securityerror', # Authentication mechanism is too weak
|
638
|
+
'5.7.10' => 'securityerror', # Encryption Needed
|
639
|
+
'5.7.11' => 'securityerror', # Encryption required for requested authentication mechanism
|
640
|
+
'5.7.13' => 'suspend', # User Account Disabled
|
641
|
+
'5.7.14' => 'securityerror', # Trust relationship required
|
642
|
+
'5.7.15' => 'securityerror', # Priority Level is too low
|
643
|
+
'5.7.16' => 'mesgtoobig', # Message is too big for the specified priority
|
644
|
+
'5.7.17' => 'hasmoved', # Mailbox owner has changed
|
645
|
+
'5.7.18' => 'hasmoved', # Domain owner has changed
|
646
|
+
'5.7.19' => 'securityerror', # RRVS test cannot be completed
|
647
|
+
'5.7.20' => 'securityerror', # No passing DKIM signature found
|
648
|
+
'5.7.21' => 'securityerror', # No acceptable DKIM signature found
|
649
|
+
'5.7.22' => 'securityerror', # No valid author-matched DKIM signature found
|
650
|
+
'5.7.23' => 'securityerror', # SPF validation failed
|
651
|
+
'5.7.24' => 'securityerror', # SPF validation error
|
652
|
+
'5.7.25' => 'blocked', # Reverse DNS validation failed
|
653
|
+
'5.7.26' => 'securityerror', # Multiple authentication checks failed
|
654
|
+
'5.7.27' => 'rejected', # Sender address has null MX
|
649
655
|
}.freeze
|
650
656
|
|
651
657
|
InternalCode = {
|
652
658
|
:temporary => {
|
653
|
-
|
654
|
-
|
655
|
-
#
|
656
|
-
|
657
|
-
|
658
|
-
#
|
659
|
-
#
|
660
|
-
|
661
|
-
#
|
662
|
-
#
|
663
|
-
|
664
|
-
#
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
#
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
#
|
675
|
-
|
659
|
+
'blocked' => '4.0.971',
|
660
|
+
'contenterror' => '4.0.960',
|
661
|
+
# 'exceedlimit' => '4.0.923',
|
662
|
+
'expired' => '4.0.947',
|
663
|
+
'filtered' => '4.0.924',
|
664
|
+
# 'hasmoved' => '4.0.916',
|
665
|
+
# 'hostunknown' => '4.0.912',
|
666
|
+
'mailboxfull' => '4.0.922',
|
667
|
+
# 'mailererror' => '4.0.939',
|
668
|
+
# 'mesgtoobig' => '4.0.934',
|
669
|
+
'networkerror' => '4.0.944',
|
670
|
+
# 'norelaying' => '4.0.909',
|
671
|
+
'notaccept' => '4.0.932',
|
672
|
+
'onhold' => '4.0.901',
|
673
|
+
'rejected' => '4.0.918',
|
674
|
+
'securityerror' => '4.0.970',
|
675
|
+
'spamdetected' => '4.0.980',
|
676
|
+
# 'suspend' => '4.0.921',
|
677
|
+
'systemerror' => '4.0.930',
|
678
|
+
'systemfull' => '4.0.931',
|
679
|
+
'toomanyconn' => '4.0.945',
|
680
|
+
# 'userunknown' => '4.0.911',
|
681
|
+
'undefined' => '4.0.900',
|
676
682
|
},
|
677
683
|
:permanent => {
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
684
|
+
'blocked' => '5.0.971',
|
685
|
+
'contenterror' => '5.0.960',
|
686
|
+
'exceedlimit' => '5.0.923',
|
687
|
+
'expired' => '5.0.947',
|
688
|
+
'filtered' => '5.0.910',
|
689
|
+
'hasmoved' => '5.0.916',
|
690
|
+
'hostunknown' => '5.0.912',
|
691
|
+
'mailboxfull' => '5.0.922',
|
692
|
+
'mailererror' => '5.0.939',
|
693
|
+
'mesgtoobig' => '5.0.934',
|
694
|
+
'networkerror' => '5.0.944',
|
695
|
+
'norelaying' => '5.0.909',
|
696
|
+
'notaccept' => '5.0.932',
|
697
|
+
'onhold' => '5.0.901',
|
698
|
+
'policyviolation' => '5.0.972',
|
699
|
+
'rejected' => '5.0.918',
|
700
|
+
'securityerror' => '5.0.970',
|
701
|
+
'spamdetected' => '5.0.980',
|
702
|
+
'suspend' => '5.0.921',
|
703
|
+
'systemerror' => '5.0.930',
|
704
|
+
'systemfull' => '5.0.931',
|
705
|
+
'syntaxerror' => '5.0.902',
|
706
|
+
'toomanyconn' => '5.0.945',
|
707
|
+
'userunknown' => '5.0.911',
|
708
|
+
'undefined' => '5.0.900',
|
709
|
+
'virusdetected' => '5.0.971',
|
704
710
|
},
|
705
711
|
}.freeze
|
706
712
|
|
@@ -708,58 +714,51 @@ module Sisimai
|
|
708
714
|
# @param [String] argv1 Reason name
|
709
715
|
# @param [True,False] argv2 false: Permanent error
|
710
716
|
# true: Temporary error
|
711
|
-
# @return [String]
|
717
|
+
# @return [String, Nil] DSN or Nil if the 1st argument is missing
|
712
718
|
# @see name
|
713
|
-
def code(argv1 =
|
714
|
-
return
|
715
|
-
return
|
719
|
+
def code(argv1 = nil, argv2 = false)
|
720
|
+
return nil unless argv1
|
721
|
+
return nil if argv1.empty?
|
716
722
|
|
717
723
|
table = argv2 ? InternalCode[:temporary] : InternalCode[:permanent]
|
718
|
-
code0 = table[argv1
|
724
|
+
code0 = table[argv1] || InternalCode[:permanent][argv1] || nil
|
719
725
|
return code0
|
720
726
|
end
|
721
727
|
|
722
728
|
# Convert from the status code to the reason string
|
723
729
|
# @param [String] argv1 Status code(DSN)
|
724
|
-
# @return [String]
|
730
|
+
# @return [String, Nil] Reason name or Nil if the first argument did
|
725
731
|
# not match with values in Sisimai's reason list
|
726
732
|
# @see code
|
727
|
-
def name(argv1 =
|
728
|
-
return
|
729
|
-
return
|
730
|
-
return StandardCode[argv1
|
733
|
+
def name(argv1 = nil)
|
734
|
+
return nil unless argv1
|
735
|
+
return nil unless argv1 =~ /\A[245][.]\d[.]\d+\z/
|
736
|
+
return StandardCode[argv1] || nil
|
731
737
|
end
|
732
738
|
|
733
739
|
# Get a DSN code value from given string including DSN
|
734
740
|
# @param [String] argv1 String including DSN
|
735
|
-
# @return [String]
|
736
|
-
#
|
737
|
-
def find(argv1 =
|
738
|
-
return
|
739
|
-
return
|
741
|
+
# @return [String, Nil] DSN or Nil if the first agument did not
|
742
|
+
# include DSN
|
743
|
+
def find(argv1 = nil)
|
744
|
+
return nil unless argv1
|
745
|
+
return nil if argv1.empty?
|
740
746
|
|
741
|
-
|
742
|
-
|
743
|
-
%r/[ ]?[(][#]([45][.]\d[.]\d+)[)]?[ ]?/, # #5.5.1
|
744
|
-
%r/\b\d{3}[- ][#]?([45][.]\d[.]\d+)\b/, # 550-5.1.1 OR 550 5.5.1
|
745
|
-
%r/\b([45][.]\d[.]\d+)\b/, # 5.5.1
|
746
|
-
%r/\b(2[.][0-7][.][0-7])\b/, # 2.1.5
|
747
|
-
]
|
748
|
-
|
749
|
-
while e = regularexp.shift do
|
747
|
+
found = nil
|
748
|
+
CodePatterns.each do |e|
|
750
749
|
# Get the value of D.S.N. in the text
|
751
750
|
next unless r = argv1.match(e)
|
752
|
-
|
751
|
+
found = r[1]
|
753
752
|
|
754
|
-
if argv1 =~ /\b(?:#{
|
753
|
+
if argv1 =~ /\b(?:#{found}[.]\d{1,3}|\d{1,3}[.]#{found})\b/
|
755
754
|
# Clear and skip if the value is an IPv4 address
|
756
|
-
|
755
|
+
found = nil
|
757
756
|
next
|
758
757
|
end
|
759
758
|
break
|
760
759
|
end
|
761
760
|
|
762
|
-
return
|
761
|
+
return found
|
763
762
|
end
|
764
763
|
|
765
764
|
end
|