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.

Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/ANALYTICAL-PRECISION +16 -25
  4. data/ChangeLog.md +41 -0
  5. data/Developers.mk +2 -2
  6. data/README-JA.md +13 -13
  7. data/README.md +13 -13
  8. data/lib/sisimai.rb +3 -7
  9. data/lib/sisimai/address.rb +25 -41
  10. data/lib/sisimai/arf.rb +58 -59
  11. data/lib/sisimai/bite.rb +0 -1
  12. data/lib/sisimai/bite/email.rb +7 -7
  13. data/lib/sisimai/bite/email/activehunter.rb +4 -3
  14. data/lib/sisimai/bite/email/amavis.rb +133 -0
  15. data/lib/sisimai/bite/email/amazonses.rb +53 -87
  16. data/lib/sisimai/bite/email/amazonworkmail.rb +51 -57
  17. data/lib/sisimai/bite/email/aol.rb +50 -76
  18. data/lib/sisimai/bite/email/apachejames.rb +2 -2
  19. data/lib/sisimai/bite/email/bigfoot.rb +47 -74
  20. data/lib/sisimai/bite/email/biglobe.rb +8 -9
  21. data/lib/sisimai/bite/email/courier.rb +56 -101
  22. data/lib/sisimai/bite/email/domino.rb +7 -8
  23. data/lib/sisimai/bite/email/einsundeins.rb +4 -5
  24. data/lib/sisimai/bite/email/exchange2003.rb +21 -22
  25. data/lib/sisimai/bite/email/exchange2007.rb +26 -28
  26. data/lib/sisimai/bite/email/exim.rb +48 -47
  27. data/lib/sisimai/bite/email/ezweb.rb +24 -36
  28. data/lib/sisimai/bite/email/facebook.rb +54 -79
  29. data/lib/sisimai/bite/email/fml.rb +10 -10
  30. data/lib/sisimai/bite/email/gmx.rb +6 -6
  31. data/lib/sisimai/bite/email/google.rb +12 -13
  32. data/lib/sisimai/bite/email/gsuite.rb +80 -108
  33. data/lib/sisimai/bite/email/imailserver.rb +16 -16
  34. data/lib/sisimai/bite/email/interscanmss.rb +4 -6
  35. data/lib/sisimai/bite/email/kddi.rb +9 -11
  36. data/lib/sisimai/bite/email/mailfoundry.rb +2 -2
  37. data/lib/sisimai/bite/email/mailmarshalsmtp.rb +2 -2
  38. data/lib/sisimai/bite/email/mailru.rb +12 -13
  39. data/lib/sisimai/bite/email/mcafee.rb +31 -25
  40. data/lib/sisimai/bite/email/messagelabs.rb +48 -87
  41. data/lib/sisimai/bite/email/messagingserver.rb +9 -10
  42. data/lib/sisimai/bite/email/mfilter.rb +16 -16
  43. data/lib/sisimai/bite/email/mxlogic.rb +11 -11
  44. data/lib/sisimai/bite/email/notes.rb +5 -6
  45. data/lib/sisimai/bite/email/office365.rb +25 -42
  46. data/lib/sisimai/bite/email/opensmtpd.rb +8 -8
  47. data/lib/sisimai/bite/email/outlook.rb +49 -67
  48. data/lib/sisimai/bite/email/postfix.rb +78 -112
  49. data/lib/sisimai/bite/email/qmail.rb +23 -23
  50. data/lib/sisimai/bite/email/receivingses.rb +53 -86
  51. data/lib/sisimai/bite/email/sendgrid.rb +65 -84
  52. data/lib/sisimai/bite/email/sendmail.rb +89 -117
  53. data/lib/sisimai/bite/email/surfcontrol.rb +15 -18
  54. data/lib/sisimai/bite/email/userdefined.rb +1 -1
  55. data/lib/sisimai/bite/email/v5sendmail.rb +3 -4
  56. data/lib/sisimai/bite/email/verizon.rb +7 -8
  57. data/lib/sisimai/bite/email/x1.rb +2 -2
  58. data/lib/sisimai/bite/email/x2.rb +2 -2
  59. data/lib/sisimai/bite/email/x3.rb +3 -3
  60. data/lib/sisimai/bite/email/x4.rb +22 -22
  61. data/lib/sisimai/bite/email/x5.rb +40 -49
  62. data/lib/sisimai/bite/email/yahoo.rb +3 -3
  63. data/lib/sisimai/bite/email/yandex.rb +54 -82
  64. data/lib/sisimai/bite/email/zoho.rb +6 -6
  65. data/lib/sisimai/bite/json/amazonses.rb +20 -20
  66. data/lib/sisimai/bite/json/sendgrid.rb +2 -2
  67. data/lib/sisimai/data.rb +27 -40
  68. data/lib/sisimai/datetime.rb +146 -162
  69. data/lib/sisimai/mda.rb +30 -31
  70. data/lib/sisimai/message/email.rb +83 -123
  71. data/lib/sisimai/message/json.rb +2 -4
  72. data/lib/sisimai/mime.rb +31 -34
  73. data/lib/sisimai/order/email.rb +23 -22
  74. data/lib/sisimai/reason.rb +61 -61
  75. data/lib/sisimai/reason/blocked.rb +139 -135
  76. data/lib/sisimai/reason/contenterror.rb +11 -10
  77. data/lib/sisimai/reason/exceedlimit.rb +4 -4
  78. data/lib/sisimai/reason/expired.rb +20 -20
  79. data/lib/sisimai/reason/filtered.rb +19 -18
  80. data/lib/sisimai/reason/hasmoved.rb +3 -3
  81. data/lib/sisimai/reason/hostunknown.rb +19 -19
  82. data/lib/sisimai/reason/mailboxfull.rb +49 -49
  83. data/lib/sisimai/reason/mailererror.rb +16 -16
  84. data/lib/sisimai/reason/mesgtoobig.rb +17 -17
  85. data/lib/sisimai/reason/networkerror.rb +19 -19
  86. data/lib/sisimai/reason/norelaying.rb +16 -16
  87. data/lib/sisimai/reason/notaccept.rb +9 -10
  88. data/lib/sisimai/reason/onhold.rb +1 -1
  89. data/lib/sisimai/reason/policyviolation.rb +21 -20
  90. data/lib/sisimai/reason/rejected.rb +53 -53
  91. data/lib/sisimai/reason/securityerror.rb +29 -29
  92. data/lib/sisimai/reason/spamdetected.rb +127 -127
  93. data/lib/sisimai/reason/suspend.rb +17 -17
  94. data/lib/sisimai/reason/systemerror.rb +22 -21
  95. data/lib/sisimai/reason/systemfull.rb +6 -6
  96. data/lib/sisimai/reason/toomanyconn.rb +19 -18
  97. data/lib/sisimai/reason/userunknown.rb +122 -121
  98. data/lib/sisimai/reason/vacation.rb +8 -8
  99. data/lib/sisimai/reason/virusdetected.rb +8 -8
  100. data/lib/sisimai/rfc1894.rb +142 -0
  101. data/lib/sisimai/rfc3464.rb +70 -70
  102. data/lib/sisimai/rfc3834.rb +15 -15
  103. data/lib/sisimai/rfc5322.rb +20 -36
  104. data/lib/sisimai/rhost.rb +1 -0
  105. data/lib/sisimai/rhost/exchangeonline.rb +31 -33
  106. data/lib/sisimai/rhost/franceptt.rb +23 -23
  107. data/lib/sisimai/rhost/godaddy.rb +28 -28
  108. data/lib/sisimai/rhost/googleapps.rb +39 -41
  109. data/lib/sisimai/rhost/kddi.rb +3 -3
  110. data/lib/sisimai/rhost/tencentqq.rb +51 -0
  111. data/lib/sisimai/smtp/error.rb +14 -21
  112. data/lib/sisimai/smtp/reply.rb +14 -13
  113. data/lib/sisimai/smtp/status.rb +178 -179
  114. data/lib/sisimai/string.rb +13 -12
  115. data/lib/sisimai/version.rb +1 -1
  116. data/set-of-emails/README.md +1 -5
  117. data/set-of-emails/maildir/bsd/arf-23.eml +49 -0
  118. data/set-of-emails/maildir/bsd/email-amavis-01.eml +78 -0
  119. data/set-of-emails/maildir/bsd/email-amavis-02.eml +78 -0
  120. data/set-of-emails/maildir/bsd/email-exchange2007-04.eml +146 -0
  121. data/set-of-emails/maildir/bsd/email-exim-60.eml +94 -0
  122. data/set-of-emails/maildir/bsd/email-ezweb-08.eml +49 -0
  123. data/set-of-emails/maildir/bsd/email-google-19.eml +67 -0
  124. data/set-of-emails/maildir/bsd/email-mcafee-05.eml +74 -0
  125. data/set-of-emails/maildir/bsd/email-messagingserver-12.eml +99 -0
  126. data/set-of-emails/maildir/bsd/email-postfix-46.eml +81 -0
  127. data/set-of-emails/maildir/bsd/email-postfix-47.eml +79 -0
  128. data/set-of-emails/maildir/bsd/email-postfix-48.eml +79 -0
  129. data/set-of-emails/maildir/bsd/email-postfix-49.eml +141 -0
  130. data/set-of-emails/maildir/bsd/email-postfix-50.eml +143 -0
  131. data/set-of-emails/maildir/bsd/email-postfix-51.eml +73 -0
  132. data/set-of-emails/maildir/bsd/email-postfix-52.eml +79 -0
  133. data/set-of-emails/maildir/bsd/email-postfix-53.eml +76 -0
  134. data/set-of-emails/maildir/bsd/email-postfix-54.eml +73 -0
  135. data/set-of-emails/maildir/bsd/email-postfix-55.eml +74 -0
  136. data/set-of-emails/maildir/bsd/email-postfix-56.eml +78 -0
  137. data/set-of-emails/maildir/bsd/email-qmail-10.eml +50 -0
  138. data/set-of-emails/maildir/bsd/email-x2-05.eml +38 -0
  139. data/set-of-emails/maildir/bsd/rhost-google-apps-02.eml +88 -0
  140. data/set-of-emails/maildir/bsd/rhost-tencentqq-01.eml +84 -0
  141. data/set-of-emails/maildir/bsd/rhost-tencentqq-02.eml +84 -0
  142. data/set-of-emails/maildir/bsd/rhost-tencentqq-03.eml +81 -0
  143. data/set-of-emails/maildir/dos/email-amavis-01.eml +78 -0
  144. data/set-of-emails/maildir/dos/email-apachejames-01.eml +1 -2
  145. data/set-of-emails/maildir/dos/email-messagelabs-01.eml +67 -50
  146. data/set-of-emails/maildir/dos/email-x4-01.eml +31 -76
  147. data/set-of-emails/maildir/dos/rhost-tencentqq-01.eml +84 -0
  148. data/set-of-emails/maildir/mac/email-amavis-01.eml +1 -4
  149. data/set-of-emails/maildir/mac/email-apachejames-01.eml +1 -9
  150. data/set-of-emails/maildir/mac/email-messagelabs-01.eml +1 -9
  151. data/set-of-emails/maildir/mac/email-x4-01.eml +1 -5
  152. data/set-of-emails/maildir/mac/rhost-tencentqq-01.eml +1 -4
  153. metadata +35 -4
  154. data/set-of-emails/logo/horizontalversions.png +0 -0
  155. data/set-of-emails/logo/icon.png +0 -0
@@ -4,12 +4,12 @@ module Sisimai
4
4
  # Imported from p5-Sisimail/lib/Sisimai/RFC5322.pm
5
5
  class << self
6
6
  HeaderTable = {
7
- :messageid => ['Message-Id'],
8
- :subject => ['Subject'],
9
- :listid => ['List-Id'],
10
- :date => %w[Date Posted-Date Posted Resent-Date],
11
- :addresser => %w[From Return-Path Reply-To Errors-To Reverse-Path X-Postfix-Sender Envelope-From X-Envelope-From],
12
- :recipient => %w[To Delivered-To Forward-Path Envelope-To X-Envelope-To Resent-To Apparently-To],
7
+ :messageid => %w[message-id],
8
+ :subject => %w[subject],
9
+ :listid => %w[list-id],
10
+ :date => %w[date posted-date posted resent-date],
11
+ :addresser => %w[from return-path reply-to errors-to reverse-path x-postfix-sender envelope-from x-envelope-from],
12
+ :recipient => %w[to delivered-to forward-path envelope-to x-envelope-to resent-to apparently-to],
13
13
  }.freeze
14
14
 
15
15
  build_regular_expressions = lambda do
@@ -44,7 +44,7 @@ module Sisimai
44
44
  # called from Sisimai::Bite::Email::*
45
45
  fv = {}
46
46
  HeaderTable.each_value do |e|
47
- e.each { |ee| fv[ee.downcase] = 1 }
47
+ e.each { |ee| fv[ee] = true }
48
48
  end
49
49
  return fv
50
50
  end
@@ -80,33 +80,20 @@ module Sisimai
80
80
  return false
81
81
  end
82
82
 
83
- # Check that the argument is an domain part of email address or not
84
- # @param [String] dpart Domain part of the email address
85
- # @return [True,False] true: Valid domain part
86
- # false: Not a valid domain part
87
- def is_domainpart(dpart)
88
- return false unless dpart.is_a?(::String)
89
- return false if dpart =~ /(?:[\x00-\x1f]|\x1f)/
90
- return false if dpart.include?('@')
91
- return true if dpart =~ Re[:domain]
92
- return false
93
- end
94
-
95
83
  # Check that the argument is mailer-daemon or not
96
84
  # @param [String] email Email address
97
85
  # @return [True,False] true: mailer-daemon
98
86
  # false: Not mailer-daemon
99
87
  def is_mailerdaemon(email)
100
88
  return false unless email.is_a?(::String)
101
-
102
- re = %r/(?:
89
+ regex = %r/(?:
103
90
  (?:mailer-daemon|postmaster)[@]
104
91
  |[<(](?:mailer-daemon|postmaster)[)>]
105
92
  |\A(?:mailer-daemon|postmaster)\z
106
93
  |[ ]?mailer-daemon[ ]
107
94
  )
108
- /x
109
- return true if email.downcase =~ re
95
+ /x.freeze
96
+ return true if email.downcase =~ regex
110
97
  return false
111
98
  end
112
99
 
@@ -202,24 +189,21 @@ module Sisimai
202
189
 
203
190
  while e = argv1.shift do
204
191
  # After "message/rfc822"
205
- if cv = e.match(/\A([-0-9A-Za-z]+?)[:][ ]*.*\z/)
206
- # Get required headers
207
- lhs = cv[1].downcase
192
+ if e.start_with?(' ', "\t")
193
+ # Continued line from the previous line
194
+ next if rfc822next[previousfn]
195
+ rfc822part << e + "\n" if LongHeaders.key?(previousfn)
196
+ else
197
+ # Get required headers only
198
+ (lhs, rhs) = e.split(/:[ ]*/, 2)
199
+ next unless lhs
200
+ lhs.downcase!
201
+
208
202
  previousfn = ''
209
203
  next unless HeaderIndex.key?(lhs)
210
204
 
211
205
  previousfn = lhs
212
206
  rfc822part << e + "\n"
213
-
214
- elsif e.start_with?(' ', "\t")
215
- # Continued line from the previous line
216
- next if rfc822next[previousfn]
217
- rfc822part << e + "\n" if LongHeaders.key?(previousfn)
218
- else
219
- # Check the end of headers in rfc822 part
220
- next unless LongHeaders.key?(previousfn)
221
- next unless e.empty?
222
- rfc822next[previousfn] = true
223
207
  end
224
208
  end
225
209
 
data/lib/sisimai/rhost.rb CHANGED
@@ -16,6 +16,7 @@ module Sisimai
16
16
  'orange.fr' => 'FrancePTT',
17
17
  'lsean.ezweb.ne.jp' => 'KDDI',
18
18
  'msmx.au.com' => 'KDDI',
19
+ '.qq.com' => 'TencentQQ',
19
20
  }.freeze
20
21
 
21
22
  # Retrun the list of remote hosts Sisimai support
@@ -91,15 +91,15 @@ module Sisimai
91
91
  }.freeze
92
92
  MessagesOf = {
93
93
  # Copied and converted from Sisimai::Bite::Email::Exchange2007
94
- expired: ['QUEUE.Expired'],
95
- hostunknown: ['SMTPSEND.DNS.NonExistentDomain'],
96
- mesgtoobig: ['RESOLVER.RST.RecipSizeLimit', 'RESOLVER.RST.RecipientSizeLimit'],
97
- networkerror: ['SMTPSEND.DNS.MxLoopback'],
98
- rejected: ['RESOLVER.RST.NotAuthorized'],
99
- securityerror: ['RESOLVER.RST.AuthRequired'],
100
- systemerror: ['RESOLVER.ADR.Ambiguous', 'RESOLVER.ADR.BadPrimary', 'RESOLVER.ADR.InvalidInSmtp'],
101
- toomanyconn: ['RESOLVER.ADR.RecipLimit', 'RESOLVER.ADR.RecipientLimit'],
102
- userunknown: [
94
+ 'expired' => ['QUEUE.Expired'],
95
+ 'hostunknown' => ['SMTPSEND.DNS.NonExistentDomain'],
96
+ 'mesgtoobig' => ['RESOLVER.RST.RecipSizeLimit', 'RESOLVER.RST.RecipientSizeLimit'],
97
+ 'networkerror' => ['SMTPSEND.DNS.MxLoopback'],
98
+ 'rejected' => ['RESOLVER.RST.NotAuthorized'],
99
+ 'securityerror' => ['RESOLVER.RST.AuthRequired'],
100
+ 'systemerror' => ['RESOLVER.ADR.Ambiguous', 'RESOLVER.ADR.BadPrimary', 'RESOLVER.ADR.InvalidInSmtp'],
101
+ 'toomanyconn' => ['RESOLVER.ADR.RecipLimit', 'RESOLVER.ADR.RecipientLimit'],
102
+ 'userunknown' => [
103
103
  'RESOLVER.ADR.RecipNotFound',
104
104
  'RESOLVER.ADR.RecipientNotFound',
105
105
  'RESOLVER.ADR.ExRecipNotFound',
@@ -128,36 +128,34 @@ module Sisimai
128
128
  end
129
129
  break unless reasontext.empty?
130
130
  end
131
+ return reasontext unless reasontext.empty?
131
132
 
132
- if reasontext.empty?
133
- ReStatuses.each_key do |e|
134
- # Try to compare with each string of delivery status codes
135
- next unless statuscode =~ e
136
- ReStatuses[e].each do |f|
137
- # Try to compare with each string of error messages
138
- f[:string].each do |g|
139
- next unless statusmesg.include?(g)
140
- reasontext = f[:reason]
141
- break
142
- end
143
- break unless reasontext.empty?
133
+ ReStatuses.each_key do |e|
134
+ # Try to compare with each string of delivery status codes
135
+ next unless statuscode =~ e
136
+ ReStatuses[e].each do |f|
137
+ # Try to compare with each string of error messages
138
+ f[:string].each do |g|
139
+ next unless statusmesg.include?(g)
140
+ reasontext = f[:reason]
141
+ break
144
142
  end
145
143
  break unless reasontext.empty?
146
144
  end
145
+ break unless reasontext.empty?
146
+ end
147
+ return reasontext unless reasontext.empty?
147
148
 
148
- if reasontext.empty?
149
- # D.S.N. included in the error message did not matched with any
150
- # key in ReStatuses
151
- MessagesOf.each_key do |e|
152
- # Try to compare with error messages defined in MessagesOf
153
- MessagesOf[e].each do |f|
154
- next unless statusmesg.include?(f)
155
- reasontext = e.to_s
156
- break
157
- end
158
- break unless reasontext.empty?
159
- end
149
+ # D.S.N. included in the error message did not matched with any
150
+ # key in ReStatuses
151
+ MessagesOf.each_key do |e|
152
+ # Try to compare with error messages defined in MessagesOf
153
+ MessagesOf[e].each do |f|
154
+ next unless statusmesg.include?(f)
155
+ reasontext = e
156
+ break
160
157
  end
158
+ break unless reasontext.empty?
161
159
  end
162
160
  return reasontext
163
161
  end
@@ -8,28 +8,28 @@ module Sisimai
8
8
  class << self
9
9
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/FrancePTT.pm
10
10
  ErrorCodes = {
11
- :'103' => 'blocked', # Service refuse. Veuillez essayer plus tard.
12
- :'104' => 'toomanyconn', # Too many connections, slow down. LPN105_104
13
- :'105' => nil, # Veuillez essayer plus tard.
14
- :'109' => nil, # Veuillez essayer plus tard. LPN003_109
15
- :'201' => nil, # Veuillez essayer plus tard. OFR004_201
16
- :'305' => 'securityerror', # 550 5.7.0 Code d'authentification invalide OFR_305
17
- :'401' => 'blocked', # 550 5.5.0 SPF: *** is not allowed to send mail. LPN004_401
18
- :'402' => 'securityerror', # 550 5.5.0 Authentification requise. Authentication Required. LPN105_402
19
- :'403' => 'rejected', # 5.0.1 Emetteur invalide. Invalid Sender.
20
- :'405' => 'rejected', # 5.0.1 Emetteur invalide. Invalid Sender. LPN105_405
21
- :'415' => 'rejected', # Emetteur invalide. Invalid Sender. OFR_415
22
- :'416' => 'userunknown', # 550 5.1.1 Adresse d au moins un destinataire invalide. Invalid recipient. LPN416
23
- :'417' => 'mailboxfull', # 552 5.1.1 Boite du destinataire pleine. Recipient overquota.
24
- :'418' => 'userunknown', # Adresse d au moins un destinataire invalide
25
- :'420' => 'suspend', # Boite du destinataire archivee. Archived recipient.
26
- :'421' => 'rejected', # 5.5.3 Mail from not owned by user. LPN105_421.
27
- :'423' => nil, # Service refused, please try later. LPN105_423
28
- :'424' => nil, # Veuillez essayer plus tard. LPN105_424
29
- :'506' => 'spamdetected', # Mail rejete. Mail rejected. OFR_506 [506]
30
- :'510' => 'blocked', # Veuillez essayer plus tard. service refused, please try later. LPN004_510
31
- :'513' => nil, # Mail rejete. Mail rejected. OUK_513
32
- :'514' => 'mesgtoobig', # Taille limite du message atteinte
11
+ '103' => 'blocked', # Service refuse. Veuillez essayer plus tard.
12
+ '104' => 'toomanyconn', # Too many connections, slow down. LPN105_104
13
+ '105' => nil, # Veuillez essayer plus tard.
14
+ '109' => nil, # Veuillez essayer plus tard. LPN003_109
15
+ '201' => nil, # Veuillez essayer plus tard. OFR004_201
16
+ '305' => 'securityerror', # 550 5.7.0 Code d'authentification invalide OFR_305
17
+ '401' => 'blocked', # 550 5.5.0 SPF: *** is not allowed to send mail. LPN004_401
18
+ '402' => 'securityerror', # 550 5.5.0 Authentification requise. Authentication Required. LPN105_402
19
+ '403' => 'rejected', # 5.0.1 Emetteur invalide. Invalid Sender.
20
+ '405' => 'rejected', # 5.0.1 Emetteur invalide. Invalid Sender. LPN105_405
21
+ '415' => 'rejected', # Emetteur invalide. Invalid Sender. OFR_415
22
+ '416' => 'userunknown', # 550 5.1.1 Adresse d au moins un destinataire invalide. Invalid recipient. LPN416
23
+ '417' => 'mailboxfull', # 552 5.1.1 Boite du destinataire pleine. Recipient overquota.
24
+ '418' => 'userunknown', # Adresse d au moins un destinataire invalide
25
+ '420' => 'suspend', # Boite du destinataire archivee. Archived recipient.
26
+ '421' => 'rejected', # 5.5.3 Mail from not owned by user. LPN105_421.
27
+ '423' => nil, # Service refused, please try later. LPN105_423
28
+ '424' => nil, # Veuillez essayer plus tard. LPN105_424
29
+ '506' => 'spamdetected', # Mail rejete. Mail rejected. OFR_506 [506]
30
+ '510' => 'blocked', # Veuillez essayer plus tard. service refused, please try later. LPN004_510
31
+ '513' => nil, # Mail rejete. Mail rejected. OUK_513
32
+ '514' => 'mesgtoobig', # Taille limite du message atteinte
33
33
  }.freeze
34
34
 
35
35
  # Detect bounce reason from Oranage or La Poste
@@ -44,7 +44,7 @@ module Sisimai
44
44
  if cv = statusmesg.match(/\b(LPN|OFR|OUK)(_[0-9]{3}|[0-9]{3}[-_][0-9]{3})\b/)
45
45
  # OUK_513, LPN105-104, OFR102-104
46
46
  v = sprintf("%03d", (cv[1] + cv[2])[-3, 3])
47
- reasontext = ErrorCodes[v.to_sym] || 'undefined'
47
+ reasontext = ErrorCodes[v] || 'undefined'
48
48
  end
49
49
  return reasontext
50
50
  end
@@ -8,34 +8,34 @@ module Sisimai
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
10
  ErrorCodes = {
11
- :IB103 => 'blocked', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103
12
- :IB104 => 'blocked', # 554 Connection refused. This IP is listed on the Spamhaus Block List (SBL). IB104
13
- :IB105 => 'blocked', # 554 Connection refused. This IP is listed on the Exploits Block List (XBL). IB105
14
- :IB106 => 'blocked', # 554 Connection refused. This IP is listed on the Policy Block List (PBL). IB106
15
- :IB007 => 'toomanyconn', # 421 Connection refused, too many sessions from This IP. Please lower the number of concurrent sessions. IB007
16
- :IB101 => 'expired', # 421 Server temporarily unavailable. Try again later. IB101
17
- :IB108 => 'blocked', # 421 Temporarily rejected. Reverse DNS for this IP failed. IB108
18
- :IB110 => 'blocked', # 554 This IP has been temporarily blocked for attempting to send too many messages containing content judged to be spam by the Internet community. IB110
19
- :IB111 => 'blocked', # 554 This IP has been blocked for the day, for attempting to send too many messages containing content judged to be spam by the Internet community. IB111
20
- :IB112 => 'blocked', # 554 This IP has been temporarily blocked for attempting to mail too many invalid recipients. IB112
21
- :IB113 => 'blocked', # 554 This IP has been blocked for the day, for attempting to mail too many invalid recipients. IB113
22
- :IB212 => 'spamdetected', # 552 This message has been rejected due to content judged to be spam by the Internet community. IB212
23
- :IB401 => 'securityerror', # 535 Authentication not allowed on IBSMTP Servers. IB401
24
- :IB501 => 'rejected', # 550 holly@coolexample.com Blank From: addresses are not allowed. Please provide a valid From. IB501
25
- :IB502 => 'rejected', # 550 holly@coolexample.com IP addresses are not allowed as a From: Address. Please provide a valid From. IB502
26
- :IB504 => 'toomanyconn', # 550 This IP has sent too many messages this hour. IB504
27
- :IB506 => 'rejected', # 550 coolexample.com From: Domain is invalid. Please provide a valid From: IB506
28
- :IB508 => 'rejected', # 550 holly@coolexample.com Invalid SPF record. Please inspect your SPF settings, and try again. IB508
29
- :IB510 => 'toomanyconn', # 550 This message has exceeded the max number of messages per session. Please open a new session and try again. IB510
30
- :IB607 => 'toomanyconn', # 550 This IP has sent too many to too many recipients this hour. IB607
31
- :IB705 => 'virusdetected', # 552 Virus infected message rejected. IB705
11
+ 'IB103' => 'blocked', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103
12
+ 'IB104' => 'blocked', # 554 Connection refused. This IP is listed on the Spamhaus Block List (SBL). IB104
13
+ 'IB105' => 'blocked', # 554 Connection refused. This IP is listed on the Exploits Block List (XBL). IB105
14
+ 'IB106' => 'blocked', # 554 Connection refused. This IP is listed on the Policy Block List (PBL). IB106
15
+ 'IB007' => 'toomanyconn', # 421 Connection refused, too many sessions from This IP. Please lower the number of concurrent sessions. IB007
16
+ 'IB101' => 'expired', # 421 Server temporarily unavailable. Try again later. IB101
17
+ 'IB108' => 'blocked', # 421 Temporarily rejected. Reverse DNS for this IP failed. IB108
18
+ 'IB110' => 'blocked', # 554 This IP has been temporarily blocked for attempting to send too many messages containing content judged to be spam by the Internet community. IB110
19
+ 'IB111' => 'blocked', # 554 This IP has been blocked for the day, for attempting to send too many messages containing content judged to be spam by the Internet community. IB111
20
+ 'IB112' => 'blocked', # 554 This IP has been temporarily blocked for attempting to mail too many invalid recipients. IB112
21
+ 'IB113' => 'blocked', # 554 This IP has been blocked for the day, for attempting to mail too many invalid recipients. IB113
22
+ 'IB212' => 'spamdetected', # 552 This message has been rejected due to content judged to be spam by the Internet community. IB212
23
+ 'IB401' => 'securityerror', # 535 Authentication not allowed on IBSMTP Servers. IB401
24
+ 'IB501' => 'rejected', # 550 holly@coolexample.com Blank From: addresses are not allowed. Please provide a valid From. IB501
25
+ 'IB502' => 'rejected', # 550 holly@coolexample.com IP addresses are not allowed as a From: Address. Please provide a valid From. IB502
26
+ 'IB504' => 'toomanyconn', # 550 This IP has sent too many messages this hour. IB504
27
+ 'IB506' => 'rejected', # 550 coolexample.com From: Domain is invalid. Please provide a valid From: IB506
28
+ 'IB508' => 'rejected', # 550 holly@coolexample.com Invalid SPF record. Please inspect your SPF settings, and try again. IB508
29
+ 'IB510' => 'toomanyconn', # 550 This message has exceeded the max number of messages per session. Please open a new session and try again. IB510
30
+ 'IB607' => 'toomanyconn', # 550 This IP has sent too many to too many recipients this hour. IB607
31
+ 'IB705' => 'virusdetected', # 552 Virus infected message rejected. IB705
32
32
  }.freeze
33
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.'],
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.'],
39
39
  }.freeze
40
40
 
41
41
  # Detect bounce reason from GoDaddy
@@ -50,13 +50,13 @@ module Sisimai
50
50
 
51
51
  if cv = statusmesg.match(/\s(IB\d{3})\b/)
52
52
  # 192.0.2.22 has sent to too many recipients this hour. IB607 ...
53
- reasontext = ErrorCodes[cv[1].to_sym]
53
+ reasontext = ErrorCodes[cv[1]]
54
54
  else
55
55
  # 553 http://www.spamhaus.org/query/bl?ip=192.0.0.222
56
56
  MessagesOf.each_key do |e|
57
57
  MessagesOf[e].each do |f|
58
58
  next unless statusmesg.include?(f)
59
- reasontext = e.to_s
59
+ reasontext = e
60
60
  break
61
61
  end
62
62
  break unless reasontext.empty?
@@ -8,29 +8,29 @@ module Sisimai
8
8
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/GoogleApps.pm
9
9
  StatusList = {
10
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."] }],
11
+ 'X.1.1' => [{ reason: 'userunknown', string: ['The email account that you tried to reach does not exist.'] }],
12
+ 'X.1.2' => [{ reason: 'hostunknown', string: ["We weren't able to find the recipient domain."] }],
13
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 '] },
14
+ { reason: 'suspend', string: ['The email account that you tried to reach is disabled.'] },
15
+ { reason: 'undefined', string: ['The user you are trying to contact is receiving mail '] },
16
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."] }],
17
+ 'X.2.2' => [{ reason: 'mailboxfull', string: ['The email account that you tried to reach is over quota.'] }],
18
+ 'X.2.3' => [{ reason: 'exceedlimit', string: ["Your message exceeded Google's message size limits."] }],
19
19
  'X.3.0' => [
20
- { reason: 'syntaxerror', stirng: ['Multiple destination domains per transaction is unsupported.'] },
21
- { reason: 'undefined', stirng: ['Mail server temporarily rejected message.'] },
20
+ { reason: 'syntaxerror', string: ['Multiple destination domains per transaction is unsupported.'] },
21
+ { reason: 'undefined', string: ['Mail server temporarily rejected message.'] },
22
22
  ],
23
- 'X.4.2' => [{ reason: 'expired', stirng: ['Timeout - closing connection.'] }],
23
+ 'X.4.2' => [{ reason: 'expired', string: ['Timeout - closing connection.'] }],
24
24
  'X.4.5' => [
25
- { reason: 'exceedlimit', stirng: ['Daily sending quota exceeded.'] },
26
- { reason: 'undefined', stirng: ['Server busy, try again later.'] },
25
+ { reason: 'exceedlimit', string: ['Daily sending quota exceeded.'] },
26
+ { reason: 'undefined', string: ['Server busy, try again later.'] },
27
27
  ],
28
- 'X.5.0' => [{ reason: 'syntaxerror', stirng: ['SMTP protocol violation'] }],
28
+ 'X.5.0' => [{ reason: 'syntaxerror', string: ['SMTP protocol violation'] }],
29
29
  'X.5.1' => [
30
- { reason: 'securityerror', stirng: ['Authentication Required.'] },
30
+ { reason: 'securityerror', string: ['Authentication Required.'] },
31
31
  {
32
32
  reason: 'syntaxerror',
33
- stirng: [
33
+ string: [
34
34
  'STARTTLS may not be repeated',
35
35
  'Too many unrecognized commands, goodbye.',
36
36
  'Unimplemented command.',
@@ -42,51 +42,51 @@ module Sisimai
42
42
  },
43
43
  ],
44
44
  'X.5.2' => [
45
- { reason: 'securityerror', stirng: ['Cannot Decode response.'] }, # 2FA related error, maybe.
46
- { reason: 'syntaxerror', stirng: ['Syntax error.'] },
45
+ { reason: 'securityerror', string: ['Cannot Decode response.'] }, # 2FA related error, maybe.
46
+ { reason: 'syntaxerror', string: ['Syntax error.'] },
47
47
  ],
48
48
  'X.5.3' => [
49
- { reason: 'mailboxfull', stirng: ['Domain policy size per transaction exceeded,'] },
50
- { reason: 'policyviolation',stirng: ['Your message has too many recipients.'] },
49
+ { reason: 'mailboxfull', string: ['Domain policy size per transaction exceeded,'] },
50
+ { reason: 'policyviolation',string: ['Your message has too many recipients.'] },
51
51
  ],
52
- 'X.5.4' => [{ reason: 'syntaxerror', stirng: ['Optional Argument not permitted for that AUTH mode.'] }],
52
+ 'X.5.4' => [{ reason: 'syntaxerror', string: ['Optional Argument not permitted for that AUTH mode.'] }],
53
53
  'X.6.0' => [
54
- { reason: 'contenterror', stirng: ['Mail message is malformed.'] },
55
- { reason: 'networkerror', stirng: ['Message exceeded 50 hops'] }
54
+ { reason: 'contenterror', string: ['Mail message is malformed.'] },
55
+ { reason: 'networkerror', string: ['Message exceeded 50 hops'] }
56
56
  ],
57
57
  'X.7.0' => [
58
58
  {
59
59
  reason: 'blocked',
60
- stirng: [
60
+ string: [
61
61
  'IP not in whitelist for RCPT domain, closing connection.',
62
62
  'Our system has detected an unusual rate of unsolicited mail originating from your IP address.',
63
63
  ],
64
64
  },
65
65
  {
66
66
  reason: 'expired',
67
- stirng: [
67
+ string: [
68
68
  'Temporary System Problem. Try again later.',
69
69
  'Try again later, closing connection.',
70
70
  ],
71
71
  },
72
72
  {
73
73
  reason: 'securityerror',
74
- stirng: [
74
+ string: [
75
75
  'TLS required for RCPT domain, closing connection.',
76
76
  'No identity changes permitted.',
77
77
  'Must issue a STARTTLS command first.',
78
78
  'Too Many Unauthenticated commands.',
79
79
  ],
80
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.'] },
81
+ { reason: 'systemerror', string: ['Cannot authenticate due to temporary system problem.'] },
82
+ { reason: 'norelaying', string: ['Mail relay denied.'] },
83
+ { reason: 'rejected', string: ['Mail Sending denied.'] },
84
84
  ],
85
85
  'X.7.1' => [
86
- { reason: 'mailboxfull', stirng: ['Email quota exceeded.'] },
86
+ { reason: 'mailboxfull', string: ['Email quota exceeded.'] },
87
87
  {
88
88
  reason: 'securityerror',
89
- stirng: [
89
+ string: [
90
90
  'Application-specific password required.',
91
91
  'Please log in with your web browser and then try again.',
92
92
  'Username and Password not accepted.',
@@ -94,16 +94,16 @@ module Sisimai
94
94
  },
95
95
  {
96
96
  reason: 'blocked',
97
- stirng: [
97
+ string: [
98
98
  'Our system has detected an unusual rate of unsolicited mail originating from your IP address.',
99
99
  "The IP you're using to send mail is not authorized to send email directly to our servers.",
100
100
  ],
101
101
  },
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.'] },
102
+ { reason: 'spamdetected', string: ['Our system has detected that this message is likely unsolicited mail.'] },
103
+ { reason: 'policyviolation',string: ['The user or domain that you are sending to (or from) has a policy'] },
104
+ { reason: 'rejected', string: ['Unauthenticated email is not accepted from this domain.'] },
105
105
  ],
106
- 'X.7.4' => [{ reason: 'syntaxerror', stirng: ['Unrecognized Authentication Type.'] }],
106
+ 'X.7.4' => [{ reason: 'syntaxerror', string: ['Unrecognized Authentication Type.'] }],
107
107
  }.freeze
108
108
 
109
109
  # Detect bounce reason from Google Apps
@@ -113,15 +113,13 @@ module Sisimai
113
113
  def get(argvs)
114
114
  return argvs.reason unless argvs.reason.empty?
115
115
 
116
- reasontext = ''
117
- statuscode = argvs.deliverystatus.clone
118
-
119
- statuscode[0] = 'X'
120
- return '' unless StatusList[statuscode.to_sym]
116
+ (statuscode = argvs.deliverystatus.clone)[0] = 'X'
117
+ return '' unless StatusList[statuscode]
121
118
 
122
- StatusList[statuscode.to_sym].each do |e|
119
+ reasontext = ''
120
+ StatusList[statuscode].each do |e|
123
121
  # Try to match
124
- next unless e[:regexp].any? { |a| argvs.diagnosticcode.include?(a) }
122
+ next unless e[:string].any? { |a| argvs.diagnosticcode.include?(a) }
125
123
  reasontext = e[:reason]
126
124
  break
127
125
  end