sisimai 4.16.0 → 4.17.0

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/ANALYTICAL-PRECISION +7 -7
  4. data/Changes +15 -0
  5. data/Makefile +1 -1
  6. data/README.md +30 -28
  7. data/lib/sisimai.rb +20 -1
  8. data/lib/sisimai/address.rb +28 -9
  9. data/lib/sisimai/arf.rb +37 -46
  10. data/lib/sisimai/data.rb +67 -43
  11. data/lib/sisimai/datetime.rb +210 -210
  12. data/lib/sisimai/mda.rb +30 -30
  13. data/lib/sisimai/message.rb +3 -5
  14. data/lib/sisimai/msp/de/einsundeins.rb +14 -42
  15. data/lib/sisimai/msp/de/gmx.rb +17 -44
  16. data/lib/sisimai/msp/jp/biglobe.rb +15 -44
  17. data/lib/sisimai/msp/jp/ezweb.rb +20 -50
  18. data/lib/sisimai/msp/jp/kddi.rb +16 -43
  19. data/lib/sisimai/msp/ru/mailru.rb +20 -48
  20. data/lib/sisimai/msp/ru/yandex.rb +16 -50
  21. data/lib/sisimai/msp/uk/messagelabs.rb +17 -51
  22. data/lib/sisimai/msp/us/amazonses.rb +18 -40
  23. data/lib/sisimai/msp/us/amazonworkmail.rb +17 -35
  24. data/lib/sisimai/msp/us/aol.rb +17 -41
  25. data/lib/sisimai/msp/us/bigfoot.rb +15 -48
  26. data/lib/sisimai/msp/us/facebook.rb +63 -90
  27. data/lib/sisimai/msp/us/google.rb +15 -44
  28. data/lib/sisimai/msp/us/office365.rb +21 -46
  29. data/lib/sisimai/msp/us/outlook.rb +17 -50
  30. data/lib/sisimai/msp/us/receivingses.rb +20 -43
  31. data/lib/sisimai/msp/us/sendgrid.rb +13 -37
  32. data/lib/sisimai/msp/us/verizon.rb +30 -74
  33. data/lib/sisimai/msp/us/yahoo.rb +12 -40
  34. data/lib/sisimai/msp/us/zoho.rb +14 -42
  35. data/lib/sisimai/mta/activehunter.rb +11 -40
  36. data/lib/sisimai/mta/apachejames.rb +18 -40
  37. data/lib/sisimai/mta/courier.rb +20 -57
  38. data/lib/sisimai/mta/domino.rb +24 -56
  39. data/lib/sisimai/mta/exchange.rb +26 -54
  40. data/lib/sisimai/mta/exim.rb +20 -39
  41. data/lib/sisimai/mta/imailserver.rb +26 -71
  42. data/lib/sisimai/mta/interscanmss.rb +26 -44
  43. data/lib/sisimai/mta/mailfoundry.rb +12 -42
  44. data/lib/sisimai/mta/mailmarshalsmtp.rb +13 -43
  45. data/lib/sisimai/mta/mcafee.rb +17 -46
  46. data/lib/sisimai/mta/messagingserver.rb +14 -47
  47. data/lib/sisimai/mta/mfilter.rb +12 -35
  48. data/lib/sisimai/mta/mxlogic.rb +18 -42
  49. data/lib/sisimai/mta/notes.rb +22 -45
  50. data/lib/sisimai/mta/opensmtpd.rb +18 -48
  51. data/lib/sisimai/mta/postfix.rb +15 -45
  52. data/lib/sisimai/mta/qmail.rb +32 -60
  53. data/lib/sisimai/mta/sendmail.rb +13 -38
  54. data/lib/sisimai/mta/surfcontrol.rb +15 -44
  55. data/lib/sisimai/mta/userdefined.rb +14 -30
  56. data/lib/sisimai/mta/v5sendmail.rb +18 -40
  57. data/lib/sisimai/mta/x1.rb +12 -41
  58. data/lib/sisimai/mta/x2.rb +12 -41
  59. data/lib/sisimai/mta/x3.rb +12 -39
  60. data/lib/sisimai/mta/x4.rb +33 -66
  61. data/lib/sisimai/mta/x5.rb +15 -42
  62. data/lib/sisimai/reason.rb +8 -71
  63. data/lib/sisimai/reason/blocked.rb +3 -0
  64. data/lib/sisimai/reason/contenterror.rb +3 -0
  65. data/lib/sisimai/reason/delivered.rb +27 -0
  66. data/lib/sisimai/reason/exceedlimit.rb +3 -0
  67. data/lib/sisimai/reason/expired.rb +3 -0
  68. data/lib/sisimai/reason/feedback.rb +18 -0
  69. data/lib/sisimai/reason/filtered.rb +4 -0
  70. data/lib/sisimai/reason/hasmoved.rb +3 -0
  71. data/lib/sisimai/reason/hostunknown.rb +3 -0
  72. data/lib/sisimai/reason/mailboxfull.rb +3 -0
  73. data/lib/sisimai/reason/mailererror.rb +3 -0
  74. data/lib/sisimai/reason/mesgtoobig.rb +3 -0
  75. data/lib/sisimai/reason/networkerror.rb +3 -0
  76. data/lib/sisimai/reason/norelaying.rb +3 -0
  77. data/lib/sisimai/reason/notaccept.rb +3 -0
  78. data/lib/sisimai/reason/onhold.rb +3 -0
  79. data/lib/sisimai/reason/rejected.rb +3 -0
  80. data/lib/sisimai/reason/securityerror.rb +3 -0
  81. data/lib/sisimai/reason/spamdetected.rb +3 -0
  82. data/lib/sisimai/reason/suspend.rb +3 -0
  83. data/lib/sisimai/reason/syntaxerror.rb +41 -0
  84. data/lib/sisimai/reason/systemerror.rb +3 -0
  85. data/lib/sisimai/reason/systemfull.rb +3 -0
  86. data/lib/sisimai/reason/toomanyconn.rb +3 -0
  87. data/lib/sisimai/reason/undefined.rb +18 -0
  88. data/lib/sisimai/reason/userunknown.rb +3 -0
  89. data/lib/sisimai/reason/vacation.rb +18 -0
  90. data/lib/sisimai/rfc3464.rb +15 -40
  91. data/lib/sisimai/rfc3834.rb +1 -10
  92. data/lib/sisimai/rfc5322.rb +57 -19
  93. data/lib/sisimai/rhost/googleapps.rb +82 -82
  94. data/lib/sisimai/smtp/reply.rb +2 -1
  95. data/lib/sisimai/smtp/status.rb +154 -152
  96. data/lib/sisimai/string.rb +2 -3
  97. data/lib/sisimai/version.rb +1 -1
  98. data/set-of-emails/maildir/bsd/rfc3464-29.eml +60 -0
  99. data/set-of-emails/maildir/bsd/us-amazonworkmail-06.eml +156 -0
  100. data/set-of-emails/maildir/bsd/us-amazonworkmail-07.eml +158 -0
  101. data/set-of-emails/maildir/bsd/us-google-15.eml +97 -0
  102. data/set-of-emails/maildir/bsd/us-google-16.eml +99 -0
  103. data/set-of-emails/maildir/bsd/us-google-17.eml +104 -0
  104. data/set-of-emails/maildir/dos/apachejames-01.eml +4 -4
  105. data/set-of-emails/maildir/dos/us-amazonworkmail-01.eml +156 -0
  106. data/set-of-emails/maildir/dos/us-office365-01.eml +102 -0
  107. data/set-of-emails/maildir/mac/apachejames-01.eml +1 -9
  108. data/set-of-emails/maildir/mac/us-amazonworkmail-01.eml +1 -7
  109. data/set-of-emails/maildir/mac/us-office365-01.eml +1 -4
  110. metadata +17 -2
@@ -82,9 +82,8 @@ module Sisimai
82
82
 
83
83
  require 'sisimai/mta'
84
84
  require 'sisimai/address'
85
- require 'sisimai/rfc5322'
86
85
 
87
- dscontents = []; dscontents << Sisimai::MTA.DELIVERYSTATUS
86
+ dscontents = [Sisimai::MTA.DELIVERYSTATUS]
88
87
  hasdivided = mbody.split("\n")
89
88
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
90
89
  maxmsgline = 5 # (Integer) Max message length(lines)
@@ -133,14 +132,6 @@ module Sisimai
133
132
  v['date'] = mhead['date']
134
133
  v['status'] = ''
135
134
 
136
- if mhead['received'].size > 0
137
- # Get localhost and remote host name from Received header.
138
- r = mhead['received']
139
- %w|lhost rhost|.each { |a| v[a] ||= '' }
140
- v['lhost'] = Sisimai::RFC5322.received(r[0]).shift if v['lhost'].empty?
141
- v['rhost'] = Sisimai::RFC5322.received(r[-1]).pop if v['rhost'].empty?
142
- end
143
-
144
135
  v.each_key { |a| v[a] ||= '' }
145
136
  return { 'ds' => dscontents, 'rfc822' => '' }
146
137
  end
@@ -4,15 +4,15 @@ 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' => ['Date', 'Posted-Date', 'Posted', 'Resent-Date'],
11
- 'addresser' => [
7
+ :messageid => ['Message-Id'],
8
+ :subject => ['Subject'],
9
+ :listid => ['List-Id'],
10
+ :date => ['Date', 'Posted-Date', 'Posted', 'Resent-Date'],
11
+ :addresser => [
12
12
  'From', 'Return-Path', 'Reply-To', 'Errors-To', 'Reverse-Path',
13
13
  'X-Postfix-Sender', 'Envelope-From', 'X-Envelope-From',
14
14
  ],
15
- 'recipient' => [
15
+ :recipient => [
16
16
  'To', 'Delivered-To', 'Forward-Path', 'Envelope-To',
17
17
  'X-Envelope-To', 'Resent-To', 'Apparently-To'
18
18
  ],
@@ -30,7 +30,7 @@ module Sisimai
30
30
  # %d33-90 / ; The rest of the US-ASCII
31
31
  # %d94-126 ; characters not including "[",
32
32
  # ; "]", or "\"
33
- re = { 'rfc5322' => nil, 'ignored' => nil, 'domain' => nil }
33
+ re = { rfc5322: nil, ignored: nil, domain: nil }
34
34
  atom = %r([a-zA-Z0-9_!#\$\%&'*+/=?\^`{}~|\-]+)o
35
35
  quoted_string = %r/"(?:\\[^\r\n]|[^\\"])*"/o
36
36
  domain_literal = %r/\[(?:\\[\x01-\x09\x0B-\x0c\x0e-\x7f]|[\x21-\x5a\x5e-\x7e])*\]/o
@@ -38,9 +38,9 @@ module Sisimai
38
38
  local_part = %r/(?:#{dot_atom}|#{quoted_string})/o
39
39
  domain = %r/(?:#{dot_atom}|#{domain_literal})/o
40
40
 
41
- re['rfc5322'] = %r/#{local_part}[@]#{domain}/o
42
- re['ignored'] = %r/#{local_part}[.]*[@]#{domain}/o
43
- re['domain'] = %r/#{domain}/o
41
+ re[:rfc5322] = %r/#{local_part}[@]#{domain}/o
42
+ re[:ignored] = %r/#{local_part}[.]*[@]#{domain}/o
43
+ re[:domain] = %r/#{domain}/o
44
44
 
45
45
  return re
46
46
  end
@@ -61,7 +61,7 @@ module Sisimai
61
61
  HeaderIndex = build_flatten_rfc822header_list.call
62
62
 
63
63
  # Grouped RFC822 headers
64
- # @param [String] group RFC822 Header group name
64
+ # @param [Symbol] group RFC822 Header group name
65
65
  # @return [Array,Hash] RFC822 Header list
66
66
  def HEADERFIELDS(group = '')
67
67
  return HeaderIndex unless group.size > 0
@@ -74,6 +74,7 @@ module Sisimai
74
74
  def LONGFIELDS
75
75
  return { 'to' => 1, 'from' => 1, 'subject' => 1, 'message-id' => 1 }
76
76
  end
77
+ LongHeaders = Sisimai::RFC5322.LONGFIELDS
77
78
 
78
79
  # Check that the argument is an email address or not
79
80
  # @param [String] email Email address string
@@ -82,7 +83,7 @@ module Sisimai
82
83
  def is_emailaddress(email)
83
84
  return false unless email.is_a?(::String)
84
85
  return false if email =~ %r/(?:[\x00-\x1f]|\x1f)/
85
- return true if email =~ Re['ignored']
86
+ return true if email =~ Re[:ignored]
86
87
  return false
87
88
  end
88
89
 
@@ -94,7 +95,7 @@ module Sisimai
94
95
  return false unless dpart.is_a?(::String)
95
96
  return false if dpart =~ /(?:[\x00-\x1f]|\x1f)/
96
97
  return false if dpart =~ /[@]/
97
- return true if dpart =~ Re['domain']
98
+ return true if dpart =~ Re[:domain]
98
99
  return false
99
100
  end
100
101
 
@@ -106,12 +107,12 @@ module Sisimai
106
107
  return false unless email.is_a?(::String)
107
108
 
108
109
  re = %r/(?:
109
- mailer-daemon[@]
110
- |[<(]mailer-daemon[)>]
111
- |\Amailer-daemon\z
112
- |[ ]?mailer-daemon[ ]
113
- )
114
- /xi
110
+ (?:mailer-daemon|postmaster)[@]
111
+ |[<(](?:mailer-daemon|postmaster)[)>]
112
+ |\A(?:mailer-daemon|postmaster)\z
113
+ |[ ]?mailer-daemon[ ]
114
+ )
115
+ /xi;
115
116
  return true if email =~ re
116
117
  return false
117
118
  end
@@ -198,6 +199,43 @@ module Sisimai
198
199
  return hosts
199
200
  end
200
201
 
202
+ # Weed out rfc822/message header fields excepct necessary fields
203
+ # @param [Array] argv1 each line divided message/rc822 part
204
+ # @return [String] Selected fields
205
+ def weedout(argv1)
206
+ return nil unless argv1.is_a?(Array)
207
+
208
+ rfc822next = { from: false, to: false, subject: false }
209
+ rfc822part = '' # (String) message/rfc822-headers part
210
+ previousfn = '' # (String) Previous field name
211
+
212
+ argv1.each do |e|
213
+ # After "message/rfc822"
214
+ if cv = e.match(/\A([-0-9A-Za-z]+?)[:][ ]*.+\z/)
215
+ # Get required headers
216
+ lhs = cv[1].downcase
217
+ previousfn = ''
218
+ next unless HeaderIndex.key?(lhs)
219
+
220
+ previousfn = lhs
221
+ rfc822part += e + "\n"
222
+
223
+ elsif e =~ /\A[ \t]+/
224
+ # Continued line from the previous line
225
+ next if rfc822next[previousfn]
226
+ rfc822part += e + "\n" if LongHeaders.key?(previousfn)
227
+
228
+ else
229
+ # Check the end of headers in rfc822 part
230
+ next unless LongHeaders.key?(previousfn)
231
+ next unless e.empty?
232
+ rfc822next[previousfn] = true
233
+ end
234
+ end
235
+
236
+ return rfc822part
237
+ end
238
+
201
239
  end
202
240
  end
203
241
  end
@@ -7,81 +7,81 @@ module Sisimai
7
7
  class << self
8
8
  # Imported from p5-Sisimail/lib/Sisimai/Rhost/GoogleApps.pm
9
9
  SMTPErrorSet = {
10
- 'X.1.1' => [
10
+ :'X.1.1' => [
11
11
  {
12
- 'reason' => 'userunknown',
13
- 'regexp' => [%r/The email account that you tried to reach does not exist[.]/],
12
+ :reason => 'userunknown',
13
+ :regexp => [%r/The email account that you tried to reach does not exist[.]/],
14
14
  }
15
15
  ],
16
- 'X.1.2' => [
16
+ :'X.1.2' => [
17
17
  {
18
- 'reason' => 'hostunknown',
19
- 'regexp' => [%r/We weren't able to find the recipient domain[.]/],
18
+ :reason => 'hostunknown',
19
+ :regexp => [%r/We weren't able to find the recipient domain[.]/],
20
20
  },
21
21
  ],
22
- 'X.2.1' => [
22
+ :'X.2.1' => [
23
23
  {
24
- 'reason' => 'undefined',
25
- 'regexp' => [
24
+ :reason => 'undefined',
25
+ :regexp => [
26
26
  %r/The user you are trying to contact is receiving mail too quickly[.]/,
27
27
  %r/The user you are trying to contact is receiving mail at a rate/,
28
28
  ],
29
29
  },
30
30
  {
31
- 'reason' => 'suspend',
32
- 'regexp' => [%r/The email account that you tried to reach is disabled[.]/],
31
+ :reason => 'suspend',
32
+ :regexp => [%r/The email account that you tried to reach is disabled[.]/],
33
33
  },
34
34
  ],
35
- 'X.2.2' => [
35
+ :'X.2.2' => [
36
36
  {
37
- 'reason' => 'mailboxfull',
38
- 'regexp' => [%r/The email account that you tried to reach is over quota[.]/],
37
+ :reason => 'mailboxfull',
38
+ :regexp => [%r/The email account that you tried to reach is over quota[.]/],
39
39
  },
40
40
  ],
41
- 'X.2.3' => [
41
+ :'X.2.3' => [
42
42
  {
43
- 'reason' => 'exceedlimit',
44
- 'regexp' => [%r/Your message exceeded Google's message size limits[.]/],
43
+ :reason => 'exceedlimit',
44
+ :regexp => [%r/Your message exceeded Google's message size limits[.]/],
45
45
  },
46
46
  ],
47
- 'X.3.0' => [
47
+ :'X.3.0' => [
48
48
  {
49
- 'reason' => 'undefined',
50
- 'regexp' => [
49
+ :reason => 'undefined',
50
+ :regexp => [
51
51
  %r/Mail server temporarily rejected message[.]/,
52
52
  %r/Multiple destination domains per transaction is unsupported[.]/,
53
53
  ],
54
54
  },
55
55
  ],
56
- 'X.4.2' => [
56
+ :'X.4.2' => [
57
57
  {
58
- 'reason' => 'expired',
59
- 'regexp' => [%r/Timeout [-] closing connection[.]/],
58
+ :reason => 'expired',
59
+ :regexp => [%r/Timeout [-] closing connection[.]/],
60
60
  },
61
61
  ],
62
- 'X.4.5' => [
62
+ :'X.4.5' => [
63
63
  {
64
- 'reason' => 'undefined',
65
- 'regexp' => [%r/Server busy, try again later[.]/],
64
+ :reason => 'undefined',
65
+ :regexp => [%r/Server busy, try again later[.]/],
66
66
  },
67
67
  {
68
- 'reason' => 'exceedlimit',
69
- 'regexp' => [%r/Daily sending quota exceeded[.]/],
68
+ :reason => 'exceedlimit',
69
+ :regexp => [%r/Daily sending quota exceeded[.]/],
70
70
  },
71
71
  ],
72
- 'X.5.0' => [
72
+ :'X.5.0' => [
73
73
  {
74
- 'reason' => 'undefined',
75
- 'regexp' => [
74
+ :reason => 'undefined',
75
+ :regexp => [
76
76
  %r/SMTP protocol violation, see RFC 2821[.]/,
77
77
  %r/SMTP protocol violation, no commands allowed to pipeline after STARTTLS/,
78
78
  ],
79
79
  },
80
80
  ],
81
- 'X.5.1' => [
81
+ :'X.5.1' => [
82
82
  {
83
- 'reason' => 'syntaxerror',
84
- 'regexp' => [
83
+ :reason => 'syntaxerror',
84
+ :regexp => [
85
85
  %r/STARTTLS may not be repeated[.]/,
86
86
  %r/Too many unrecognized commands, goodbye[.]/,
87
87
  %r/Unimplemented command[.]/,
@@ -92,62 +92,62 @@ module Sisimai
92
92
  ],
93
93
  },
94
94
  {
95
- 'reason' => 'securityerror',
96
- 'regexp' => [%r/Authentication Required[.]/],
95
+ :reason => 'securityerror',
96
+ :regexp => [%r/Authentication Required[.]/],
97
97
  },
98
98
  ],
99
- 'X.5.2' => [
99
+ :'X.5.2' => [
100
100
  {
101
- 'reason' => 'undefined',
102
- 'regexp' => [%r/Cannot Decode response[.]/],
101
+ :reason => 'undefined',
102
+ :regexp => [%r/Cannot Decode response[.]/],
103
103
  },
104
104
  {
105
- 'reason' => 'syntaxerror',
106
- 'regexp' => [%r/Syntax error[.]/],
105
+ :reason => 'syntaxerror',
106
+ :regexp => [%r/Syntax error[.]/],
107
107
  },
108
108
  ],
109
- 'X.5.3' => [
109
+ :'X.5.3' => [
110
110
  {
111
- 'reason' => 'undefined',
112
- 'regexp' => [
111
+ :reason => 'undefined',
112
+ :regexp => [
113
113
  %r/Domain policy size per transaction exceeded[,]/,
114
114
  %r/Your message has too many recipients[.]/,
115
115
  ],
116
116
  },
117
117
  ],
118
- 'X.5.4' => [
118
+ :'X.5.4' => [
119
119
  {
120
- 'reason' => 'syntaxerror',
121
- 'regexp' => [%r/Optional Argument not permitted for that AUTH mode[.]/],
120
+ :reason => 'syntaxerror',
121
+ :regexp => [%r/Optional Argument not permitted for that AUTH mode[.]/],
122
122
  },
123
123
  ],
124
- 'X.6.0' => [
124
+ :'X.6.0' => [
125
125
  {
126
- 'reason' => 'contenterror',
127
- 'regexp' => [
126
+ :reason => 'contenterror',
127
+ :regexp => [
128
128
  %r/Mail message is malformed[.]/,
129
129
  %r/Message exceeded 50 hops/,
130
130
  ],
131
131
  },
132
132
  ],
133
- 'X.7.0' => [
133
+ :'X.7.0' => [
134
134
  {
135
- 'reason' => 'blocked',
136
- 'regexp' => [
135
+ :reason => 'blocked',
136
+ :regexp => [
137
137
  %r/IP not in whitelist for RCPT domain, closing connection[.]/,
138
138
  %r/Our system has detected an unusual rate of unsolicited mail originating from your IP address[.]/,
139
139
  ],
140
140
  },
141
141
  {
142
- 'reason' => 'expired',
143
- 'regexp' => [
142
+ :reason => 'expired',
143
+ :regexp => [
144
144
  %r/Temporary System Problem. Try again later[.]/,
145
145
  %r/Try again later, closing connection[.]/,
146
146
  ],
147
147
  },
148
148
  {
149
- 'reason' => 'securityerror',
150
- 'regexp' => [
149
+ :reason => 'securityerror',
150
+ :regexp => [
151
151
  %r/TLS required for RCPT domain, closing connection[.]/,
152
152
  %r/No identity changes permitted[.]/,
153
153
  %r/Must issue a STARTTLS command first[.]/,
@@ -155,55 +155,55 @@ module Sisimai
155
155
  ],
156
156
  },
157
157
  {
158
- 'reason' => 'systemerror',
159
- 'regexp' => [%r/Cannot authenticate due to temporary system problem[.]/],
158
+ :reason => 'systemerror',
159
+ :regexp => [%r/Cannot authenticate due to temporary system problem[.]/],
160
160
  },
161
161
  {
162
- 'reason' => 'norelaying',
163
- 'regexp' => [%r/Mail relay denied[.]/],
162
+ :reason => 'norelaying',
163
+ :regexp => [%r/Mail relay denied[.]/],
164
164
  },
165
165
  {
166
- 'reason' => 'rejected',
167
- 'regexp' => [%r/Mail Sending denied[.]/],
166
+ :reason => 'rejected',
167
+ :regexp => [%r/Mail Sending denied[.]/],
168
168
  },
169
169
  ],
170
- 'X.7.1' => [
170
+ :'X.7.1' => [
171
171
  {
172
- 'reason' => 'securityerror',
173
- 'regexp' => [
172
+ :reason => 'securityerror',
173
+ :regexp => [
174
174
  %r/Application-specific password required[.]/,
175
175
  %r/Please log in with your web browser and then try again[.]/,
176
176
  %r/Username and Password not accepted[.]/,
177
177
  ],
178
178
  },
179
179
  {
180
- 'reason' => 'mailboxfull',
181
- 'regexp' => [%r/Email quota exceeded[.]/],
180
+ :reason => 'mailboxfull',
181
+ :regexp => [%r/Email quota exceeded[.]/],
182
182
  },
183
183
  {
184
- 'reason' => 'blocked',
185
- 'regexp' => [
184
+ :reason => 'blocked',
185
+ :regexp => [
186
186
  %r/Our system has detected an unusual rate of unsolicited mail originating from your IP address[.]/,
187
187
  %r/The IP you[']re using to send mail is not authorized to send email directly to our servers[.]/,
188
188
  ],
189
189
  },
190
190
  {
191
- 'reason' => 'contenterror',
192
- 'regexp' => [%r/Our system has detected that this message is likely unsolicited mail[.]/],
191
+ :reason => 'contenterror',
192
+ :regexp => [%r/Our system has detected that this message is likely unsolicited mail[.]/],
193
193
  },
194
194
  {
195
- 'reason' => 'filtered',
196
- 'regexp' => [%r/The user or domain that you are sending to [(]or from[)] has a policy/],
195
+ :reason => 'filtered',
196
+ :regexp => [%r/The user or domain that you are sending to [(]or from[)] has a policy/],
197
197
  },
198
198
  {
199
- 'reason' => 'rejected',
200
- 'regexp' => [%r/Unauthenticated email is not accepted from this domain[.]/],
199
+ :reason => 'rejected',
200
+ :regexp => [%r/Unauthenticated email is not accepted from this domain[.]/],
201
201
  },
202
202
  ],
203
- 'X.7.4' => [
203
+ :'X.7.4' => [
204
204
  {
205
- 'reason' => 'securityerror',
206
- 'regexp' => [%r/Unrecognized Authentication Type[.]/],
205
+ :reason => 'securityerror',
206
+ :regexp => [%r/Unrecognized Authentication Type[.]/],
207
207
  },
208
208
  ],
209
209
  }
@@ -220,12 +220,12 @@ module Sisimai
220
220
  statuscode = argvs.deliverystatus.sub(/\A\d[.](\d+[.]\d+)\z/, 'X.\1')
221
221
  statusmesg = argvs.diagnosticcode
222
222
  reasontext = ''
223
- errortable = SMTPErrorSet[statuscode] || []
223
+ errortable = SMTPErrorSet[statuscode.to_sym] || []
224
224
 
225
225
  errortable.each do |e|
226
226
  # Try to match
227
- next unless e['regexp'].find { |a| statusmesg =~ a }
228
- reasontext = e['reason']
227
+ next unless e[:regexp].find { |a| statusmesg =~ a }
228
+ reasontext = e[:reason]
229
229
  break if reasontext.size > 0
230
230
  end
231
231
  return reasontext