sisimai 4.22.3-java → 4.22.4-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.

Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Benchmarks.mk +54 -0
  4. data/ChangeLog.md +23 -2
  5. data/Developers.mk +42 -35
  6. data/Makefile +10 -0
  7. data/README-JA.md +13 -13
  8. data/README.md +14 -14
  9. data/lib/sisimai.rb +12 -18
  10. data/lib/sisimai/address.rb +64 -82
  11. data/lib/sisimai/arf.rb +27 -42
  12. data/lib/sisimai/bite/email.rb +2 -4
  13. data/lib/sisimai/bite/email/activehunter.rb +12 -17
  14. data/lib/sisimai/bite/email/amazonses.rb +30 -48
  15. data/lib/sisimai/bite/email/amazonworkmail.rb +20 -27
  16. data/lib/sisimai/bite/email/aol.rb +27 -35
  17. data/lib/sisimai/bite/email/apachejames.rb +17 -28
  18. data/lib/sisimai/bite/email/bigfoot.rb +20 -33
  19. data/lib/sisimai/bite/email/biglobe.rb +15 -24
  20. data/lib/sisimai/bite/email/courier.rb +37 -61
  21. data/lib/sisimai/bite/email/domino.rb +19 -28
  22. data/lib/sisimai/bite/email/einsundeins.rb +20 -34
  23. data/lib/sisimai/bite/email/exchange2003.rb +25 -43
  24. data/lib/sisimai/bite/email/exchange2007.rb +15 -23
  25. data/lib/sisimai/bite/email/exim.rb +101 -120
  26. data/lib/sisimai/bite/email/ezweb.rb +28 -44
  27. data/lib/sisimai/bite/email/facebook.rb +26 -37
  28. data/lib/sisimai/bite/email/fml.rb +11 -20
  29. data/lib/sisimai/bite/email/gmx.rb +17 -27
  30. data/lib/sisimai/bite/email/google.rb +19 -29
  31. data/lib/sisimai/bite/email/gsuite.rb +39 -48
  32. data/lib/sisimai/bite/email/imailserver.rb +25 -39
  33. data/lib/sisimai/bite/email/interscanmss.rb +19 -26
  34. data/lib/sisimai/bite/email/kddi.rb +20 -33
  35. data/lib/sisimai/bite/email/mailfoundry.rb +14 -24
  36. data/lib/sisimai/bite/email/mailmarshalsmtp.rb +15 -24
  37. data/lib/sisimai/bite/email/mailru.rb +40 -59
  38. data/lib/sisimai/bite/email/mcafee.rb +21 -35
  39. data/lib/sisimai/bite/email/messagelabs.rb +23 -38
  40. data/lib/sisimai/bite/email/messagingserver.rb +15 -27
  41. data/lib/sisimai/bite/email/mfilter.rb +19 -28
  42. data/lib/sisimai/bite/email/mxlogic.rb +31 -49
  43. data/lib/sisimai/bite/email/notes.rb +16 -24
  44. data/lib/sisimai/bite/email/office365.rb +29 -38
  45. data/lib/sisimai/bite/email/opensmtpd.rb +50 -67
  46. data/lib/sisimai/bite/email/outlook.rb +24 -36
  47. data/lib/sisimai/bite/email/postfix.rb +33 -42
  48. data/lib/sisimai/bite/email/qmail.rb +44 -59
  49. data/lib/sisimai/bite/email/receivingses.rb +28 -36
  50. data/lib/sisimai/bite/email/sendgrid.rb +28 -37
  51. data/lib/sisimai/bite/email/sendmail.rb +35 -51
  52. data/lib/sisimai/bite/email/surfcontrol.rb +17 -25
  53. data/lib/sisimai/bite/email/userdefined.rb +17 -28
  54. data/lib/sisimai/bite/email/v5sendmail.rb +32 -41
  55. data/lib/sisimai/bite/email/verizon.rb +31 -56
  56. data/lib/sisimai/bite/email/x1.rb +11 -18
  57. data/lib/sisimai/bite/email/x2.rb +11 -23
  58. data/lib/sisimai/bite/email/x3.rb +10 -19
  59. data/lib/sisimai/bite/email/x4.rb +46 -65
  60. data/lib/sisimai/bite/email/x5.rb +26 -37
  61. data/lib/sisimai/bite/email/yahoo.rb +11 -19
  62. data/lib/sisimai/bite/email/yandex.rb +19 -30
  63. data/lib/sisimai/bite/email/zoho.rb +21 -30
  64. data/lib/sisimai/bite/json.rb +1 -2
  65. data/lib/sisimai/bite/json/amazonses.rb +20 -25
  66. data/lib/sisimai/bite/json/sendgrid.rb +1 -1
  67. data/lib/sisimai/data.rb +36 -55
  68. data/lib/sisimai/data/json.rb +3 -3
  69. data/lib/sisimai/data/yaml.rb +1 -1
  70. data/lib/sisimai/datetime.rb +5 -21
  71. data/lib/sisimai/mail.rb +4 -6
  72. data/lib/sisimai/mail/maildir.rb +1 -1
  73. data/lib/sisimai/mda.rb +41 -44
  74. data/lib/sisimai/message.rb +2 -3
  75. data/lib/sisimai/message/email.rb +42 -52
  76. data/lib/sisimai/message/json.rb +7 -7
  77. data/lib/sisimai/mime.rb +25 -23
  78. data/lib/sisimai/order/email.rb +2 -2
  79. data/lib/sisimai/order/json.rb +2 -7
  80. data/lib/sisimai/reason.rb +41 -46
  81. data/lib/sisimai/reason/blocked.rb +60 -71
  82. data/lib/sisimai/reason/contenterror.rb +4 -8
  83. data/lib/sisimai/reason/delivered.rb +1 -3
  84. data/lib/sisimai/reason/exceedlimit.rb +10 -20
  85. data/lib/sisimai/reason/expired.rb +5 -9
  86. data/lib/sisimai/reason/feedback.rb +1 -3
  87. data/lib/sisimai/reason/filtered.rb +19 -38
  88. data/lib/sisimai/reason/hasmoved.rb +5 -8
  89. data/lib/sisimai/reason/hostunknown.rb +11 -18
  90. data/lib/sisimai/reason/mailboxfull.rb +14 -24
  91. data/lib/sisimai/reason/mailererror.rb +3 -5
  92. data/lib/sisimai/reason/mesgtoobig.rb +15 -25
  93. data/lib/sisimai/reason/networkerror.rb +8 -10
  94. data/lib/sisimai/reason/norelaying.rb +9 -14
  95. data/lib/sisimai/reason/notaccept.rb +9 -21
  96. data/lib/sisimai/reason/onhold.rb +3 -8
  97. data/lib/sisimai/reason/policyviolation.rb +8 -10
  98. data/lib/sisimai/reason/rejected.rb +36 -49
  99. data/lib/sisimai/reason/securityerror.rb +11 -13
  100. data/lib/sisimai/reason/spamdetected.rb +23 -37
  101. data/lib/sisimai/reason/suspend.rb +9 -10
  102. data/lib/sisimai/reason/syntaxerror.rb +3 -4
  103. data/lib/sisimai/reason/systemerror.rb +7 -9
  104. data/lib/sisimai/reason/systemfull.rb +2 -4
  105. data/lib/sisimai/reason/toomanyconn.rb +17 -30
  106. data/lib/sisimai/reason/undefined.rb +1 -3
  107. data/lib/sisimai/reason/userunknown.rb +28 -38
  108. data/lib/sisimai/reason/vacation.rb +4 -6
  109. data/lib/sisimai/reason/virusdetected.rb +4 -6
  110. data/lib/sisimai/rfc2606.rb +1 -2
  111. data/lib/sisimai/rfc3464.rb +87 -101
  112. data/lib/sisimai/rfc3834.rb +29 -39
  113. data/lib/sisimai/rfc5322.rb +17 -24
  114. data/lib/sisimai/rhost.rb +10 -7
  115. data/lib/sisimai/rhost/exchangeonline.rb +124 -255
  116. data/lib/sisimai/rhost/franceptt.rb +2 -2
  117. data/lib/sisimai/rhost/godaddy.rb +12 -25
  118. data/lib/sisimai/rhost/googleapps.rb +82 -183
  119. data/lib/sisimai/smtp.rb +4 -4
  120. data/lib/sisimai/smtp/error.rb +8 -8
  121. data/lib/sisimai/smtp/reply.rb +1 -1
  122. data/lib/sisimai/smtp/status.rb +1 -0
  123. data/lib/sisimai/string.rb +5 -7
  124. data/lib/sisimai/version.rb +1 -1
  125. data/set-of-emails/README.md +1 -1
  126. data/set-of-emails/maildir/bsd/README.md +50 -50
  127. data/sisimai-java.gemspec +1 -1
  128. data/sisimai.gemspec +1 -1
  129. metadata +4 -4
  130. data/lib/sisimai/skeleton.rb +0 -43
@@ -7,7 +7,7 @@ module Sisimai
7
7
  module FrancePTT
8
8
  class << self
9
9
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/FrancePTT.pm
10
- CodeTable = {
10
+ ErrorCodes = {
11
11
  :'103' => 'blocked', # Service refuse. Veuillez essayer plus tard.
12
12
  :'104' => 'toomanyconn', # Too many connections, slow down. LPN105_104
13
13
  :'105' => nil, # Veuillez essayer plus tard.
@@ -46,7 +46,7 @@ module Sisimai
46
46
  if cv = statusmesg.match(/\b(LPN|OFR|OUK)(_[0-9]{3}|[0-9]{3}[-_][0-9]{3})\b/)
47
47
  # OUK_513, LPN105-104, OFR102-104
48
48
  v = sprintf("%03d", (cv[1] + cv[2])[-3, 3])
49
- reasontext = CodeTable[v.to_sym] || 'undefined'
49
+ reasontext = ErrorCodes[v.to_sym] || 'undefined'
50
50
  end
51
51
  return reasontext
52
52
  end
@@ -7,7 +7,7 @@ module Sisimai
7
7
  class << self
8
8
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/GoDaddy.pm
9
9
  # https://www.godaddy.com/help/what-does-my-email-bounceback-mean-3568
10
- CodeTable = {
10
+ ErrorCodes = {
11
11
  :IB103 => 'blocked', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103
12
12
  :IB104 => 'blocked', # 554 Connection refused. This IP is listed on the Spamhaus Block List (SBL). IB104
13
13
  :IB105 => 'blocked', # 554 Connection refused. This IP is listed on the Exploits Block List (XBL). IB105
@@ -30,26 +30,12 @@ module Sisimai
30
30
  :IB607 => 'toomanyconn', # 550 This IP has sent too many to too many recipients this hour. IB607
31
31
  :IB705 => 'virusdetected', # 552 Virus infected message rejected. IB705
32
32
  }.freeze
33
-
34
- MesgTable = {
35
- :blocked => [
36
- %r{\A553 http://www[.]spamhaus[.]org/query/bl[?]ip=.+},
37
- %r/\A554 RBL Reject[.]/,
38
- ],
39
- :expired => [
40
- %r/Delivery timeout/,
41
- %r/451 Sorry, I wasn't able to establish an SMTP connection[.]/,
42
- ],
43
- :mailboxfull => [
44
- %r/Account storage limit/,
45
- ],
46
- :userunknown => [
47
- %r/Account does not exist/,
48
- %r/550 Recipient not found[.]/,
49
- ],
50
- :suspend => [
51
- %r/Account disabled/,
52
- ],
33
+ MessagesOf = {
34
+ blocked: ['553 http://www.spamhaus.org/query/bl?ip=', '554 RBL Reject.'],
35
+ expired: ['Delivery timeout', "451 Sorry, I wasn't able to establish an SMTP connection."],
36
+ suspend: ['Account disabled'],
37
+ mailboxfull: ['Account storage limit'],
38
+ userunknown: ['Account does not exist', '550 Recipient not found.'],
53
39
  }.freeze
54
40
 
55
41
  # Detect bounce reason from GoDaddy
@@ -66,15 +52,16 @@ module Sisimai
66
52
 
67
53
  if cv = statusmesg.match(/\s(IB\d{3})\b/)
68
54
  # 192.0.2.22 has sent to too many recipients this hour. IB607 ...
69
- reasontext = CodeTable[cv[1].to_sym]
55
+ reasontext = ErrorCodes[cv[1].to_sym]
70
56
  else
71
57
  # 553 http://www.spamhaus.org/query/bl?ip=192.0.0.222
72
- MesgTable.each_key do |e|
73
- MesgTable[e].each do |f|
74
- next unless statusmesg =~ f
58
+ MessagesOf.each_key do |e|
59
+ MessagesOf[e].each do |f|
60
+ next unless statusmesg.include?(f)
75
61
  reasontext = e.to_s
76
62
  break
77
63
  end
64
+ break if reasontext.size > 0
78
65
  end
79
66
  end
80
67
  return reasontext
@@ -6,206 +6,104 @@ module Sisimai
6
6
  module GoogleApps
7
7
  class << self
8
8
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/GoogleApps.pm
9
- CodeTable = {
10
- :'X.1.1' => [
11
- {
12
- :reason => 'userunknown',
13
- :regexp => [%r/The email account that you tried to reach does not exist[.]/],
14
- }
15
- ],
16
- :'X.1.2' => [
17
- {
18
- :reason => 'hostunknown',
19
- :regexp => [%r/We weren't able to find the recipient domain[.]/],
20
- },
21
- ],
22
- :'X.2.1' => [
23
- {
24
- :reason => 'undefined',
25
- :regexp => [
26
- %r/The user you are trying to contact is receiving mail too quickly[.]/,
27
- %r/The user you are trying to contact is receiving mail at a rate/,
9
+ StatusList = {
10
+ # https://support.google.com/a/answer/3726730
11
+ 'X.1.1' => [{ reason: 'userunknown', stirng: ['The email account that you tried to reach does not exist.'] }],
12
+ 'X.1.2' => [{ reason: 'hostunknown', stirng: ["We weren't able to find the recipient domain."] }],
13
+ 'X.2.1' => [
14
+ { reason: 'suspend', stirng: ['The email account that you tried to reach is disabled.'] },
15
+ { reason: 'undefined', stirng: ['The user you are trying to contact is receiving mail '] },
16
+ ],
17
+ 'X.2.2' => [{ reason: 'mailboxfull', stirng: ['The email account that you tried to reach is over quota.'] }],
18
+ 'X.2.3' => [{ reason: 'exceedlimit', stirng: ["Your message exceeded Google's message size limits."] }],
19
+ 'X.3.0' => [
20
+ { reason: 'syntaxerror', stirng: ['Multiple destination domains per transaction is unsupported.'] },
21
+ { reason: 'undefined', stirng: ['Mail server temporarily rejected message.'] },
22
+ ],
23
+ 'X.4.2' => [{ reason: 'expired', stirng: ['Timeout - closing connection.'] }],
24
+ 'X.4.5' => [
25
+ { reason: 'exceedlimit', stirng: ['Daily sending quota exceeded.'] },
26
+ { reason: 'undefined', stirng: ['Server busy, try again later.'] },
27
+ ],
28
+ 'X.5.0' => [{ reason: 'syntaxerror', stirng: ['SMTP protocol violation'] }],
29
+ 'X.5.1' => [
30
+ { reason: 'securityerror', stirng: ['Authentication Required.'] },
31
+ {
32
+ reason: 'syntaxerror',
33
+ stirng: [
34
+ 'STARTTLS may not be repeated',
35
+ 'Too many unrecognized commands, goodbye.',
36
+ 'Unimplemented command.',
37
+ 'Unrecognized command.',
38
+ 'EHLO/HELO first.',
39
+ 'MAIL first.',
40
+ 'RCPT first.',
28
41
  ],
29
42
  },
30
- {
31
- :reason => 'suspend',
32
- :regexp => [%r/The email account that you tried to reach is disabled[.]/],
33
- },
34
43
  ],
35
- :'X.2.2' => [
36
- {
37
- :reason => 'mailboxfull',
38
- :regexp => [%r/The email account that you tried to reach is over quota[.]/],
39
- },
40
- ],
41
- :'X.2.3' => [
42
- {
43
- :reason => 'exceedlimit',
44
- :regexp => [%r/Your message exceeded Google's message size limits[.]/],
45
- },
46
- ],
47
- :'X.3.0' => [
48
- {
49
- :reason => 'undefined',
50
- :regexp => [
51
- %r/Mail server temporarily rejected message[.]/,
52
- %r/Multiple destination domains per transaction is unsupported[.]/,
53
- ],
54
- },
44
+ 'X.5.2' => [
45
+ { reason: 'securityerror', stirng: ['Cannot Decode response.'] }, # 2FA related error, maybe.
46
+ { reason: 'syntaxerror', stirng: ['Syntax error.'] },
55
47
  ],
56
- :'X.4.2' => [
57
- {
58
- :reason => 'expired',
59
- :regexp => [%r/Timeout [-] closing connection[.]/],
60
- },
48
+ 'X.5.3' => [
49
+ { reason: 'mailboxfull', stirng: ['Domain policy size per transaction exceeded,'] },
50
+ { reason: 'policyviolation',stirng: ['Your message has too many recipients.'] },
61
51
  ],
62
- :'X.4.5' => [
63
- {
64
- :reason => 'undefined',
65
- :regexp => [%r/Server busy, try again later[.]/],
66
- },
67
- {
68
- :reason => 'exceedlimit',
69
- :regexp => [%r/Daily sending quota exceeded[.]/],
70
- },
52
+ 'X.5.4' => [{ reason: 'syntaxerror', stirng: ['Optional Argument not permitted for that AUTH mode.'] }],
53
+ 'X.6.0' => [
54
+ { reason: 'contenterror', stirng: ['Mail message is malformed.'] },
55
+ { reason: 'networkerror', stirng: ['Message exceeded 50 hops'] }
71
56
  ],
72
- :'X.5.0' => [
57
+ 'X.7.0' => [
73
58
  {
74
- :reason => 'undefined',
75
- :regexp => [
76
- %r/SMTP protocol violation, see RFC 2821[.]/,
77
- %r/SMTP protocol violation, no commands allowed to pipeline after STARTTLS/,
59
+ reason: 'blocked',
60
+ stirng: [
61
+ 'IP not in whitelist for RCPT domain, closing connection.',
62
+ 'Our system has detected an unusual rate of unsolicited mail originating from your IP address.',
78
63
  ],
79
64
  },
80
- ],
81
- :'X.5.1' => [
82
65
  {
83
- :reason => 'syntaxerror',
84
- :regexp => [
85
- %r/STARTTLS may not be repeated[.]/,
86
- %r/Too many unrecognized commands, goodbye[.]/,
87
- %r/Unimplemented command[.]/,
88
- %r/Unrecognized command[.]/,
89
- %r|EHLO/HELO first[.]|,
90
- %r/MAIL first[.]/,
91
- %r/RCPT first[.]/,
66
+ reason: 'expired',
67
+ stirng: [
68
+ 'Temporary System Problem. Try again later.',
69
+ 'Try again later, closing connection.',
92
70
  ],
93
71
  },
94
72
  {
95
- :reason => 'securityerror',
96
- :regexp => [%r/Authentication Required[.]/],
97
- },
98
- ],
99
- :'X.5.2' => [
100
- {
101
- :reason => 'undefined',
102
- :regexp => [%r/Cannot Decode response[.]/],
103
- },
104
- {
105
- :reason => 'syntaxerror',
106
- :regexp => [%r/Syntax error[.]/],
107
- },
108
- ],
109
- :'X.5.3' => [
110
- {
111
- :reason => 'undefined',
112
- :regexp => [
113
- %r/Domain policy size per transaction exceeded[,]/,
114
- %r/Your message has too many recipients[.]/,
73
+ reason: 'securityerror',
74
+ stirng: [
75
+ 'TLS required for RCPT domain, closing connection.',
76
+ 'No identity changes permitted.',
77
+ 'Must issue a STARTTLS command first.',
78
+ 'Too Many Unauthenticated commands.',
115
79
  ],
116
80
  },
81
+ { reason: 'systemerror', stirng: ['Cannot authenticate due to temporary system problem.'] },
82
+ { reason: 'norelaying', stirng: ['Mail relay denied.'] },
83
+ { reason: 'rejected', stirng: ['Mail Sending denied.'] },
117
84
  ],
118
- :'X.5.4' => [
85
+ 'X.7.1' => [
86
+ { reason: 'mailboxfull', stirng: ['Email quota exceeded.'] },
119
87
  {
120
- :reason => 'syntaxerror',
121
- :regexp => [%r/Optional Argument not permitted for that AUTH mode[.]/],
122
- },
123
- ],
124
- :'X.6.0' => [
125
- {
126
- :reason => 'contenterror',
127
- :regexp => [
128
- %r/Mail message is malformed[.]/,
129
- %r/Message exceeded 50 hops/,
130
- ],
131
- },
132
- ],
133
- :'X.7.0' => [
134
- {
135
- :reason => 'blocked',
136
- :regexp => [
137
- %r/IP not in whitelist for RCPT domain, closing connection[.]/,
138
- %r/Our system has detected an unusual rate of unsolicited mail originating from your IP address[.]/,
88
+ reason: 'securityerror',
89
+ stirng: [
90
+ 'Application-specific password required.',
91
+ 'Please log in with your web browser and then try again.',
92
+ 'Username and Password not accepted.',
139
93
  ],
140
94
  },
141
95
  {
142
- :reason => 'expired',
143
- :regexp => [
144
- %r/Temporary System Problem. Try again later[.]/,
145
- %r/Try again later, closing connection[.]/,
96
+ reason: 'blocked',
97
+ stirng: [
98
+ 'Our system has detected an unusual rate of unsolicited mail originating from your IP address.',
99
+ "The IP you're using to send mail is not authorized to send email directly to our servers.",
146
100
  ],
147
101
  },
148
- {
149
- :reason => 'securityerror',
150
- :regexp => [
151
- %r/TLS required for RCPT domain, closing connection[.]/,
152
- %r/No identity changes permitted[.]/,
153
- %r/Must issue a STARTTLS command first[.]/,
154
- %r/Too Many Unauthenticated commands[.]/,
155
- ],
156
- },
157
- {
158
- :reason => 'systemerror',
159
- :regexp => [%r/Cannot authenticate due to temporary system problem[.]/],
160
- },
161
- {
162
- :reason => 'norelaying',
163
- :regexp => [%r/Mail relay denied[.]/],
164
- },
165
- {
166
- :reason => 'rejected',
167
- :regexp => [%r/Mail Sending denied[.]/],
168
- },
169
- ],
170
- :'X.7.1' => [
171
- {
172
- :reason => 'securityerror',
173
- :regexp => [
174
- %r/Application-specific password required[.]/,
175
- %r/Please log in with your web browser and then try again[.]/,
176
- %r/Username and Password not accepted[.]/,
177
- ],
178
- },
179
- {
180
- :reason => 'mailboxfull',
181
- :regexp => [%r/Email quota exceeded[.]/],
182
- },
183
- {
184
- :reason => 'blocked',
185
- :regexp => [
186
- %r/Our system has detected an unusual rate of unsolicited mail originating from your IP address[.]/,
187
- %r/The IP you[']re using to send mail is not authorized to send email directly to our servers[.]/,
188
- ],
189
- },
190
- {
191
- :reason => 'contenterror',
192
- :regexp => [%r/Our system has detected that this message is likely unsolicited mail[.]/],
193
- },
194
- {
195
- :reason => 'filtered',
196
- :regexp => [%r/The user or domain that you are sending to [(]or from[)] has a policy/],
197
- },
198
- {
199
- :reason => 'rejected',
200
- :regexp => [%r/Unauthenticated email is not accepted from this domain[.]/],
201
- },
202
- ],
203
- :'X.7.4' => [
204
- {
205
- :reason => 'securityerror',
206
- :regexp => [%r/Unrecognized Authentication Type[.]/],
207
- },
102
+ { reason: 'spamdetected', stirng: ['Our system has detected that this message is likely unsolicited mail.'] },
103
+ { reason: 'policyviolation',stirng: ['The user or domain that you are sending to (or from) has a policy'] },
104
+ { reason: 'rejected', stirng: ['Unauthenticated email is not accepted from this domain.'] },
208
105
  ],
106
+ 'X.7.4' => [{ reason: 'syntaxerror', stirng: ['Unrecognized Authentication Type.'] }],
209
107
  }.freeze
210
108
 
211
109
  # Detect bounce reason from Google Apps
@@ -217,16 +115,17 @@ module Sisimai
217
115
  return nil unless argvs.is_a? Sisimai::Data
218
116
  return argvs.reason if argvs.reason.size > 0
219
117
 
220
- statuscode = argvs.deliverystatus.sub(/\A\d[.](\d+[.]\d+)\z/, 'X.\1')
221
- statusmesg = argvs.diagnosticcode
222
118
  reasontext = ''
223
- errortable = CodeTable[statuscode.to_sym] || []
119
+ statuscode = argvs.deliverystatus.clone
120
+
121
+ statuscode[0] = 'X'
122
+ return '' unless StatusList[statuscode.to_sym]
224
123
 
225
- errortable.each do |e|
124
+ StatusList[statuscode.to_sym].each do |e|
226
125
  # Try to match
227
- next unless e[:regexp].find { |a| statusmesg =~ a }
126
+ next unless e[:regexp].find { |a| argvs.diagnosticcode.include?(a) }
228
127
  reasontext = e[:reason]
229
- break if reasontext.size > 0
128
+ break
230
129
  end
231
130
  return reasontext
232
131
  end
data/lib/sisimai/smtp.rb CHANGED
@@ -9,10 +9,10 @@ module Sisimai
9
9
  # @return [Hash] SMTP command regular expressions
10
10
  def command
11
11
  return {
12
- :helo => %r/\b(?:HELO|EHLO)\b/,
13
- :mail => %r/\bMAIL F(?:ROM|rom)\b/,
14
- :rcpt => %r/\bRCPT T[Oo]\b/,
15
- :data => %r/\bDATA\b/,
12
+ helo: %r/\b(?:HELO|EHLO)\b/,
13
+ mail: %r/\bMAIL F(?:ROM|rom)\b/,
14
+ rcpt: %r/\bRCPT T[Oo]\b/,
15
+ data: %r/\bDATA\b/,
16
16
  }
17
17
  end
18
18
 
@@ -9,13 +9,12 @@ module Sisimai
9
9
  require 'sisimai/smtp/status'
10
10
 
11
11
  SoftOrHard = {
12
- :soft => %w|
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
- systemfull toomanyconn virusdetected
17
- |,
18
- :hard => %w|hasmoved hostunknown userunknown|
16
+ systemfull toomanyconn virusdetected],
17
+ :hard => %w[hasmoved hostunknown userunknown]
19
18
  }.freeze
20
19
 
21
20
  # Permanent error or not
@@ -49,10 +48,11 @@ module Sisimai
49
48
  end
50
49
  else
51
50
  # Check with regular expression
52
- getchecked = if argv1 =~ /(?:temporar|persistent)/i
51
+ v = argv1.downcase
52
+ getchecked = if v.include?('temporar') || v.include?('persistent')
53
53
  # Temporary failure
54
54
  false
55
- elsif argv1 =~ /permanent/i
55
+ elsif v.include?('permanent')
56
56
  # Permanently failure
57
57
  true
58
58
  end
@@ -74,7 +74,7 @@ module Sisimai
74
74
  getchecked = nil
75
75
  softorhard = nil
76
76
 
77
- if argv1 =~ /\A(?:delivered|feedback|vacation)\z/
77
+ if %w[delivered feedback vacation].include?(argv1)
78
78
  # These are not dealt as a bounce reason
79
79
  softorhard = ''
80
80
 
@@ -115,7 +115,7 @@ module Sisimai
115
115
  else
116
116
  # Check all the reasons defined at the above
117
117
  catch :SOFT_OR_HARD do
118
- loop do
118
+ while true
119
119
  [:hard, :soft].each do |e|
120
120
  # Soft or Hard?
121
121
  SoftOrHard[e].each do |f|