sisimai 4.22.1 → 4.22.2

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +21 -0
  3. data/README-JA.md +2 -2
  4. data/README.md +2 -2
  5. data/lib/sisimai.rb +2 -3
  6. data/lib/sisimai/address.rb +20 -40
  7. data/lib/sisimai/arf.rb +4 -4
  8. data/lib/sisimai/bite.rb +1 -0
  9. data/lib/sisimai/bite/email.rb +3 -4
  10. data/lib/sisimai/bite/email/activehunter.rb +7 -7
  11. data/lib/sisimai/bite/email/amazonses.rb +14 -14
  12. data/lib/sisimai/bite/email/amazonworkmail.rb +7 -7
  13. data/lib/sisimai/bite/email/aol.rb +8 -8
  14. data/lib/sisimai/bite/email/apachejames.rb +7 -7
  15. data/lib/sisimai/bite/email/bigfoot.rb +7 -7
  16. data/lib/sisimai/bite/email/biglobe.rb +7 -7
  17. data/lib/sisimai/bite/email/courier.rb +9 -9
  18. data/lib/sisimai/bite/email/domino.rb +8 -8
  19. data/lib/sisimai/bite/email/einsundeins.rb +7 -7
  20. data/lib/sisimai/bite/email/exchange2003.rb +10 -10
  21. data/lib/sisimai/bite/email/exchange2007.rb +10 -10
  22. data/lib/sisimai/bite/email/exim.rb +18 -19
  23. data/lib/sisimai/bite/email/ezweb.rb +9 -11
  24. data/lib/sisimai/bite/email/facebook.rb +22 -23
  25. data/lib/sisimai/bite/email/gmx.rb +7 -7
  26. data/lib/sisimai/bite/email/google.rb +22 -25
  27. data/lib/sisimai/bite/email/gsuite.rb +17 -19
  28. data/lib/sisimai/bite/email/imailserver.rb +13 -13
  29. data/lib/sisimai/bite/email/interscanmss.rb +7 -7
  30. data/lib/sisimai/bite/email/kddi.rb +7 -7
  31. data/lib/sisimai/bite/email/mailfoundry.rb +6 -6
  32. data/lib/sisimai/bite/email/mailmarshalsmtp.rb +13 -13
  33. data/lib/sisimai/bite/email/mailru.rb +10 -10
  34. data/lib/sisimai/bite/email/mcafee.rb +7 -7
  35. data/lib/sisimai/bite/email/messagelabs.rb +9 -9
  36. data/lib/sisimai/bite/email/messagingserver.rb +8 -8
  37. data/lib/sisimai/bite/email/mfilter.rb +7 -7
  38. data/lib/sisimai/bite/email/mxlogic.rb +9 -9
  39. data/lib/sisimai/bite/email/notes.rb +12 -12
  40. data/lib/sisimai/bite/email/office365.rb +14 -15
  41. data/lib/sisimai/bite/email/opensmtpd.rb +7 -7
  42. data/lib/sisimai/bite/email/outlook.rb +9 -9
  43. data/lib/sisimai/bite/email/postfix.rb +13 -13
  44. data/lib/sisimai/bite/email/qmail.rb +9 -9
  45. data/lib/sisimai/bite/email/receivingses.rb +9 -9
  46. data/lib/sisimai/bite/email/sendgrid.rb +9 -9
  47. data/lib/sisimai/bite/email/sendmail.rb +7 -7
  48. data/lib/sisimai/bite/email/surfcontrol.rb +7 -7
  49. data/lib/sisimai/bite/email/userdefined.rb +7 -7
  50. data/lib/sisimai/bite/email/v5sendmail.rb +21 -22
  51. data/lib/sisimai/bite/email/verizon.rb +8 -8
  52. data/lib/sisimai/bite/email/x1.rb +6 -6
  53. data/lib/sisimai/bite/email/x2.rb +6 -6
  54. data/lib/sisimai/bite/email/x3.rb +6 -6
  55. data/lib/sisimai/bite/email/x4.rb +9 -9
  56. data/lib/sisimai/bite/email/x5.rb +6 -6
  57. data/lib/sisimai/bite/email/yahoo.rb +7 -7
  58. data/lib/sisimai/bite/email/yandex.rb +7 -7
  59. data/lib/sisimai/bite/email/zoho.rb +8 -8
  60. data/lib/sisimai/bite/json.rb +10 -11
  61. data/lib/sisimai/bite/json/amazonses.rb +11 -11
  62. data/lib/sisimai/bite/json/sendgrid.rb +67 -17
  63. data/lib/sisimai/data.rb +19 -21
  64. data/lib/sisimai/data/json.rb +3 -3
  65. data/lib/sisimai/data/yaml.rb +3 -3
  66. data/lib/sisimai/datetime.rb +18 -21
  67. data/lib/sisimai/mail.rb +1 -1
  68. data/lib/sisimai/mail/stdin.rb +2 -2
  69. data/lib/sisimai/mda.rb +4 -4
  70. data/lib/sisimai/message.rb +1 -1
  71. data/lib/sisimai/message/email.rb +32 -35
  72. data/lib/sisimai/message/json.rb +3 -3
  73. data/lib/sisimai/mime.rb +5 -6
  74. data/lib/sisimai/order/email.rb +11 -11
  75. data/lib/sisimai/order/json.rb +3 -3
  76. data/lib/sisimai/reason.rb +2 -2
  77. data/lib/sisimai/reason/userunknown.rb +4 -5
  78. data/lib/sisimai/rfc3464.rb +14 -16
  79. data/lib/sisimai/rfc3834.rb +5 -5
  80. data/lib/sisimai/rfc5322.rb +2 -2
  81. data/lib/sisimai/rhost.rb +6 -5
  82. data/lib/sisimai/rhost/exchangeonline.rb +1 -1
  83. data/lib/sisimai/rhost/godaddy.rb +87 -0
  84. data/lib/sisimai/rhost/googleapps.rb +1 -1
  85. data/lib/sisimai/smtp/error.rb +21 -27
  86. data/lib/sisimai/smtp/status.rb +2 -2
  87. data/lib/sisimai/string.rb +7 -7
  88. data/lib/sisimai/version.rb +1 -1
  89. data/set-of-emails/jsonobj/json-sendgrid-12.json +1 -0
  90. data/set-of-emails/jsonobj/json-sendgrid-13.json +1 -0
  91. data/set-of-emails/jsonobj/json-sendgrid-14.json +1 -0
  92. data/set-of-emails/jsonobj/json-sendgrid-15.json +1 -0
  93. data/set-of-emails/jsonobj/json-sendgrid-16.json +1 -0
  94. data/set-of-emails/jsonobj/json-sendgrid-17.json +1 -0
  95. data/set-of-emails/maildir/bsd/rhost-godaddy-01.eml +83 -0
  96. data/set-of-emails/maildir/bsd/rhost-godaddy-02.eml +69 -0
  97. metadata +12 -6
  98. data/lib/sisimai/ced.rb +0 -48
  99. data/lib/sisimai/msp.rb +0 -39
  100. data/lib/sisimai/mta.rb +0 -39
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Exchange2007 parses a bounce email which created by
3
+ # Microsoft Exchange Server 2007.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module Exchange2007
3
- # Sisimai::Bite::Email::Exchange2007 parses a bounce email which created by
4
- # Microsoft Exchange Server 2007.
5
- # Methods in the module are called from only Sisimai::Message.
6
6
  class << self
7
7
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Exchange2007.pm
8
8
  require 'sisimai/bite/email'
@@ -10,14 +10,14 @@ module Sisimai::Bite::Email
10
10
  Re0 = {
11
11
  :'subject' => %r/\AUndeliverable:/,
12
12
  :'content-language' => %r/\A[a-z]{2}(?:[-][A-Z]{2})?\z/,
13
- }
13
+ }.freeze
14
14
  Re1 = {
15
15
  :begin => %r/[ ]Microsoft[ ]Exchange[ ]Server[ ]20\d{2}/,
16
16
  :error => %r/[ ]((?:RESOLVER|QUEUE)[.][A-Za-z]+(?:[.]\w+)?);/,
17
17
  :rhost => %r/\AGenerating[ ]server:[ ]?(.*)/,
18
18
  :rfc822 => %r/\AOriginal message headers:/,
19
19
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
20
- }
20
+ }.freeze
21
21
  NDRSubject = {
22
22
  :'SMTPSEND.DNS.NonExistentDomain'=> 'hostunknown', # 554 5.4.4 SMTPSEND.DNS.NonExistentDomain
23
23
  :'SMTPSEND.DNS.MxLoopback' => 'networkerror', # 554 5.4.4 SMTPSEND.DNS.MxLoopback
@@ -31,7 +31,7 @@ module Sisimai::Bite::Email
31
31
  :'RESOLVER.RST.NotAuthorized' => 'rejected', # 550 5.7.1 RESOLVER.RST.NotAuthorized
32
32
  :'RESOLVER.RST.RecipSizeLimit' => 'mesgtoobig', # 550 5.2.3 RESOLVER.RST.RecipSizeLimit
33
33
  :'QUEUE.Expired' => 'expired', # 550 4.4.7 QUEUE.Expired
34
- }
34
+ }.freeze
35
35
  Indicators = Sisimai::Bite::Email.INDICATORS
36
36
 
37
37
  def description; return 'Microsoft Exchange Server 2007'; end
@@ -64,7 +64,7 @@ module Sisimai::Bite::Email
64
64
  blanklines = 0 # (Integer) The number of blank lines
65
65
  readcursor = 0 # (Integer) Points the current cursor position
66
66
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
67
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
67
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
68
68
  connheader = {
69
69
  'rhost' => '', # The value of Reporting-MTA header or "Generating Server:"
70
70
  }
@@ -79,7 +79,7 @@ module Sisimai::Bite::Email
79
79
  end
80
80
  end
81
81
 
82
- if readcursor & Indicators[:'message-rfc822'] == 0
82
+ if (readcursor & Indicators[:'message-rfc822']).zero?
83
83
  # Beginning of the original message part
84
84
  if e =~ Re1[:rfc822]
85
85
  readcursor |= Indicators[:'message-rfc822']
@@ -98,7 +98,7 @@ module Sisimai::Bite::Email
98
98
 
99
99
  else
100
100
  # Before "message/rfc822"
101
- next if readcursor & Indicators[:deliverystatus] == 0
101
+ next if (readcursor & Indicators[:deliverystatus]).zero?
102
102
 
103
103
  if connvalues == connheader.keys.size
104
104
  # Diagnostic information for administrators:
@@ -131,7 +131,7 @@ module Sisimai::Bite::Email
131
131
  v['diagnosis'] = e
132
132
 
133
133
  else
134
- if v['diagnosis'].to_s.size > 0 && v['diagnosis'] =~ /=\z/
134
+ if v['diagnosis'].to_s.size > 0 && v['diagnosis'].end_with?('=')
135
135
  # Continued line of error messages
136
136
  v['diagnosis'] = v['diagnosis'].sub(/=\z/, '')
137
137
  v['diagnosis'] += e
@@ -1,14 +1,14 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Exim parses a bounce email which created by Exim.
3
+ # Methods in the module are called from only Sisimai::Message.
2
4
  module Exim
3
- # Sisimai::Bite::Email::Exim parses a bounce email which created by Exim.
4
- # Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Exim.pm
7
7
  require 'sisimai/bite/email'
8
8
 
9
9
  ReE = {
10
10
  :from => %r/[@].+[.]mail[.]ru[>]?/,
11
- }
11
+ }.freeze
12
12
  Re0 = {
13
13
  :from => %r/\AMail Delivery System/,
14
14
  :subject => %r{(?:
@@ -22,7 +22,7 @@ module Sisimai::Bite::Email
22
22
  }x,
23
23
  # :'message-id' => %r/\A[<]\w+[-]\w+[-]\w+[@].+\z/,
24
24
  # Message-Id: <E1P1YNN-0003AD-Ga@example.org>
25
- }
25
+ }.freeze
26
26
 
27
27
  # Error text regular expressions which defined in exim/src/deliver.c
28
28
  #
@@ -63,7 +63,7 @@ module Sisimai::Bite::Email
63
63
  }x,
64
64
  :deliverystatus => %r|\AContent-type: message/delivery-status|,
65
65
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
66
- }
66
+ }.freeze
67
67
 
68
68
  ReCommand = [
69
69
  # transports/smtp.c:564| *message = US string_sprintf("SMTP error from remote mail server after %s%s: "
@@ -72,7 +72,7 @@ module Sisimai::Bite::Email
72
72
  %r/SMTP error from remote (?:mail server|mailer) after end of ([A-Za-z]{4})/,
73
73
  %r/LMTP error after ([A-Za-z]{4})/,
74
74
  %r/LMTP error after end of ([A-Za-z]{4})/,
75
- ]
75
+ ].freeze
76
76
 
77
77
  # find exim/ -type f -exec grep 'message = US' {} /dev/null \;
78
78
  ReFailure = {
@@ -111,7 +111,7 @@ module Sisimai::Bite::Email
111
111
  }x,
112
112
  # deliver.c:5425| new->message = US"Too many \"Received\" headers - suspected mail loop";
113
113
  contenterror: %r/Too[ ]many[ ]["]Received["][ ]headers/x,
114
- }
114
+ }.freeze
115
115
 
116
116
  # retry.c:902| addr->message = (addr->message == NULL)? US"retry timeout exceeded" :
117
117
  # deliver.c:7475| "No action is required on your part. Delivery attempts will continue for\n"
@@ -187,7 +187,7 @@ module Sisimai::Bite::Email
187
187
  end
188
188
  end
189
189
 
190
- if readcursor & Indicators[:'message-rfc822'] == 0
190
+ if (readcursor & Indicators[:'message-rfc822']).zero?
191
191
  # Beginning of the original message part
192
192
  if e =~ Re1[:rfc822]
193
193
  readcursor |= Indicators[:'message-rfc822']
@@ -206,7 +206,7 @@ module Sisimai::Bite::Email
206
206
 
207
207
  else
208
208
  # Before "message/rfc822"
209
- next if readcursor & Indicators[:deliverystatus] == 0
209
+ next if (readcursor & Indicators[:deliverystatus]).zero?
210
210
  next if e.empty?
211
211
 
212
212
  # This message was created automatically by mail delivery software.
@@ -330,7 +330,7 @@ module Sisimai::Bite::Email
330
330
  recipients = rcptinhead.size
331
331
 
332
332
  rcptinhead.each do |e|
333
- # Insert each recipient address into @$dscontents
333
+ # Insert each recipient address into dscontents
334
334
  dscontents[-1]['recipient'] = e
335
335
  next if dscontents.size == recipients
336
336
  dscontents << Sisimai::Bite.DELIVERYSTATUS
@@ -387,7 +387,7 @@ module Sisimai::Bite::Email
387
387
  e['diagnosis'] ||= e['alterrors']
388
388
  end
389
389
 
390
- if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'] =~ /__\z/
390
+ if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'].end_with?('__')
391
391
  # Override the value of diagnostic code message
392
392
  e['diagnosis'] = e['alterrors'] if e['alterrors'].size > 0
393
393
 
@@ -499,14 +499,13 @@ module Sisimai::Bite::Email
499
499
  e['status'] = sv if r1 > 0
500
500
  else
501
501
  # Neither Status nor SMTP reply code exist
502
- if e['reason'] =~ /\A(?:expired|mailboxfull)/
503
- # Set pseudo DSN (temporary error)
504
- sv = Sisimai::SMTP::Status.code(e['reason'], true)
505
-
506
- else
507
- # Set pseudo DSN (permanent error)
508
- sv = Sisimai::SMTP::Status.code(e['reason'], false)
509
- end
502
+ sv = if e['reason'] =~ /\A(?:expired|mailboxfull)/
503
+ # Set pseudo DSN (temporary error)
504
+ Sisimai::SMTP::Status.code(e['reason'], true)
505
+ else
506
+ # Set pseudo DSN (permanent error)
507
+ Sisimai::SMTP::Status.code(e['reason'], false)
508
+ end
510
509
  end
511
510
  e['status'] ||= sv
512
511
  e.each_key { |a| e[a] ||= '' }
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::EZweb parses a bounce email which created by au EZweb.
3
+ # Methods in the module are called from only Sisimai::Message.
2
4
  module EZweb
3
- # Sisimai::Bite::Email::EZweb parses a bounce email which created by au EZweb.
4
- # Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/EZweb.pm
7
7
  require 'sisimai/bite/email'
@@ -11,7 +11,7 @@ module Sisimai::Bite::Email
11
11
  :'subject' => %r/\AMail System Error - Returned Mail\z/,
12
12
  :'received' => %r/\Afrom[ ](?:.+[.])?ezweb[.]ne[.]jp[ ]/,
13
13
  :'message-id' => %r/[@].+[.]ezweb[.]ne[.]jp[>]\z/,
14
- }
14
+ }.freeze
15
15
  Re1 = {
16
16
  :begin => %r{\A(?:
17
17
  The[ ]user[(]s[)][ ]
@@ -23,7 +23,7 @@ module Sisimai::Bite::Email
23
23
  :rfc822 => %r#\A(?:[-]{50}|Content-Type:[ ]*message/rfc822)#,
24
24
  :boundary => %r/\A__SISIMAI_PSEUDO_BOUNDARY__\z/,
25
25
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
26
- }
26
+ }.freeze
27
27
  ReFailure = {
28
28
  # notaccept: [ %r/The following recipients did not receive this message:/ ],
29
29
  mailboxfull: [
@@ -43,7 +43,7 @@ module Sisimai::Bite::Email
43
43
  onhold: [
44
44
  %r/Each of the following recipients was rejected by a remote mail server/,
45
45
  ],
46
- }
46
+ }.freeze
47
47
  Indicators = Sisimai::Bite::Email.INDICATORS
48
48
 
49
49
  def description; return 'au EZweb: http://www.au.kddi.com/mobile/'; end
@@ -102,12 +102,10 @@ module Sisimai::Bite::Email
102
102
  hasdivided.each do |e|
103
103
  if readcursor.zero?
104
104
  # Beginning of the bounce message or delivery status part
105
- if e =~ Re1[:begin]
106
- readcursor |= Indicators[:deliverystatus]
107
- end
105
+ readcursor |= Indicators[:deliverystatus] if e =~ Re1[:begin]
108
106
  end
109
107
 
110
- if readcursor & Indicators[:'message-rfc822'] == 0
108
+ if (readcursor & Indicators[:'message-rfc822']).zero?
111
109
  # Beginning of the original message part
112
110
  if e =~ Re1[:rfc822] || e =~ rxboundary
113
111
  readcursor |= Indicators[:'message-rfc822']
@@ -126,7 +124,7 @@ module Sisimai::Bite::Email
126
124
 
127
125
  else
128
126
  # Before "message/rfc822"
129
- next if readcursor & Indicators[:deliverystatus] == 0
127
+ next if (readcursor & Indicators[:deliverystatus]).zero?
130
128
  next if e.empty?
131
129
 
132
130
  # The user(s) account is disabled.
@@ -204,7 +202,7 @@ module Sisimai::Bite::Email
204
202
  if e['alterrors'] && e['alterrors'].size > 0
205
203
  # Copy alternative error message
206
204
  e['diagnosis'] ||= e['alterrors']
207
- if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'] =~ /__\z/
205
+ if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'].end_with?('__')
208
206
  # Override the value of diagnostic code message
209
207
  e['diagnosis'] = e['alterrors'] if e['alterrors'].size > 0
210
208
  end
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Facebook parses a bounce email which created by Facebook.
3
+ # Methods in the module are called from only Sisimai::Message.
2
4
  module Facebook
3
- # Sisimai::Bite::Email::Facebook parses a bounce email which created by Facebook.
4
- # Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Facebook.pm
7
7
  require 'sisimai/bite/email'
@@ -9,12 +9,12 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/\AFacebook [<]mailer-daemon[@]mx[.]facebook[.]com[>]\z/,
11
11
  :subject => %r/\ASorry, your message could not be delivered\z/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/\AThis message was created automatically by Facebook[.]\z/,
15
15
  :rfc822 => %r/\AContent-Disposition: inline\z/,
16
16
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
17
- }
17
+ }.freeze
18
18
 
19
19
  # http://postmaster.facebook.com/response_codes
20
20
  # NOT TESTD EXCEPT RCP-P2
@@ -74,7 +74,7 @@ module Sisimai::Bite::Email
74
74
  'CON-T2', # Your mail server currently has too many connections open to Facebook's mail servers.
75
75
  'CON-T4', # Your mail server has exceeded the maximum number of recipients for its current connection.
76
76
  ],
77
- }
77
+ }.freeze
78
78
  Indicators = Sisimai::Bite::Email.INDICATORS
79
79
 
80
80
  def description; return 'Facebook: https://www.facebook.com'; end
@@ -107,7 +107,7 @@ module Sisimai::Bite::Email
107
107
  readcursor = 0 # (Integer) Points the current cursor position
108
108
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
109
109
  fbresponse = '' # (String) Response code from Facebook
110
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
110
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
111
111
  connheader = {
112
112
  'date' => '', # The value of Arrival-Date header
113
113
  'lhost' => '', # The value of Reporting-MTA header
@@ -127,7 +127,7 @@ module Sisimai::Bite::Email
127
127
  end
128
128
  end
129
129
 
130
- if readcursor & Indicators[:'message-rfc822'] == 0
130
+ if (readcursor & Indicators[:'message-rfc822']).zero?
131
131
  # Beginning of the original message part
132
132
  if e =~ Re1[:rfc822]
133
133
  readcursor |= Indicators[:'message-rfc822']
@@ -146,7 +146,7 @@ module Sisimai::Bite::Email
146
146
 
147
147
  else
148
148
  # Before "message/rfc822"
149
- next if readcursor & Indicators[:deliverystatus] == 0
149
+ next if (readcursor & Indicators[:deliverystatus]).zero?
150
150
  next if e.empty?
151
151
 
152
152
  if connvalues == connheader.keys.size
@@ -247,21 +247,20 @@ module Sisimai::Bite::Email
247
247
  end
248
248
  end
249
249
 
250
- unless e['reason']
251
- # http://postmaster.facebook.com/response_codes
252
- # Facebook System Resource Issues
253
- # These codes indicate a temporary issue internal to Facebook's
254
- # system. Administrators observing these issues are not required to
255
- # take any action to correct them.
256
- if fbresponse =~ /\AINT-T\d+\z/
257
- # * INT-Tx
258
- #
259
- # https://groups.google.com/forum/#!topic/cdmix/eXfi4ddgYLQ
260
- # This block has not been tested because we have no email sample
261
- # including "INT-T?" error code.
262
- e['reason'] = 'systemerror'
263
- end
264
- end
250
+ # http://postmaster.facebook.com/response_codes
251
+ # Facebook System Resource Issues
252
+ # These codes indicate a temporary issue internal to Facebook's
253
+ # system. Administrators observing these issues are not required to
254
+ # take any action to correct them.
255
+ next if e['reason']
256
+
257
+ # * INT-Tx
258
+ #
259
+ # https://groups.google.com/forum/#!topic/cdmix/eXfi4ddgYLQ
260
+ # This block has not been tested because we have no email sample
261
+ # including "INT-T?" error code.
262
+ next unless fbresponse =~ /\AINT-T\d+\z/
263
+ e['reason'] = 'systemerror'
265
264
  end
266
265
 
267
266
  rfc822part = Sisimai::RFC5322.weedout(rfc822list)
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::GMX parses a bounce email which created by GMX.
3
+ # Methods in the module are called from only Sisimai::Message.
2
4
  module GMX
3
- # Sisimai::Bite::Email::GMX parses a bounce email which created by GMX.
4
- # Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/GMX.pm
7
7
  require 'sisimai/bite/email'
@@ -9,15 +9,15 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/\AMAILER-DAEMON[@]/,
11
11
  :subject => %r/\AMail delivery failed: returning message to sender\z/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/\AThis message was created automatically by mail delivery software/,
15
15
  :rfc822 => %r/\A--- The header of the original message is following/,
16
16
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
17
- }
17
+ }.freeze
18
18
  ReFailure = {
19
19
  expired: %r/delivery[ ]retry[ ]timeout[ ]exceeded/x,
20
- }
20
+ }.freeze
21
21
  Indicators = Sisimai::Bite::Email.INDICATORS
22
22
 
23
23
  def description; return 'GMX: http://www.gmx.net'; end
@@ -63,7 +63,7 @@ module Sisimai::Bite::Email
63
63
  end
64
64
  end
65
65
 
66
- if readcursor & Indicators[:'message-rfc822'] == 0
66
+ if (readcursor & Indicators[:'message-rfc822']).zero?
67
67
  # Beginning of the original message part
68
68
  if e =~ Re1[:rfc822]
69
69
  readcursor |= Indicators[:'message-rfc822']
@@ -82,7 +82,7 @@ module Sisimai::Bite::Email
82
82
 
83
83
  else
84
84
  # Before "message/rfc822"
85
- next if readcursor & Indicators[:deliverystatus] == 0
85
+ next if (readcursor & Indicators[:deliverystatus]).zero?
86
86
  next if e.empty?
87
87
 
88
88
  # This message was created automatically by mail delivery software.
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Google parses a bounce email which created by Gmail.
3
+ # Methods in the module are called from only Sisimai::Message.
2
4
  module Google
3
- # Sisimai::Bite::Email::Google parses a bounce email which created by Gmail.
4
- # Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Google.pm
7
7
  require 'sisimai/bite/email'
@@ -9,7 +9,7 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/[@]googlemail[.]com[>]?\z/,
11
11
  :subject => %r/Delivery[ ]Status[ ]Notification/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/Delivery to the following recipient/,
15
15
  :start => %r/Technical details of (?:permanent|temporary) failure:/,
@@ -20,7 +20,7 @@ module Sisimai::Bite::Email
20
20
  )\z
21
21
  }x,
22
22
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
23
- }
23
+ }.freeze
24
24
  ReFailure = {
25
25
  expired: %r{(?:
26
26
  DNS[ ]Error:[ ]Could[ ]not[ ]contact[ ]DNS[ ]servers
@@ -33,7 +33,7 @@ module Sisimai::Bite::Email
33
33
  |DNS[ ]server[ ]returned[ ]answer[ ]with[ ]no[ ]data
34
34
  )
35
35
  }x,
36
- }
36
+ }.freeze
37
37
  StateTable = {
38
38
  # Technical details of permanent failure:
39
39
  # Google tried to deliver your message, but it was rejected by the recipient domain.
@@ -106,7 +106,7 @@ module Sisimai::Bite::Email
106
106
  # cause of this error. The error that the other server returned was:
107
107
  # 550 550 Unknown user *****@***.**.*** (state 18).
108
108
  '18' => { 'command' => 'DATA', 'reason' => 'filtered' },
109
- }
109
+ }.freeze
110
110
  Indicators = Sisimai::Bite::Email.INDICATORS
111
111
 
112
112
  def description; return 'Google Gmail: https://mail.google.com'; end
@@ -192,12 +192,10 @@ module Sisimai::Bite::Email
192
192
  hasdivided.each do |e|
193
193
  if readcursor.zero?
194
194
  # Beginning of the bounce message or delivery status part
195
- if e =~ Re1[:begin]
196
- readcursor |= Indicators[:deliverystatus]
197
- end
195
+ readcursor |= Indicators[:deliverystatus] if e =~ Re1[:begin]
198
196
  end
199
197
 
200
- if readcursor & Indicators[:'message-rfc822'] == 0
198
+ if (readcursor & Indicators[:'message-rfc822']).zero?
201
199
  # Beginning of the original message part
202
200
  if e =~ Re1[:rfc822]
203
201
  readcursor |= Indicators[:'message-rfc822']
@@ -216,7 +214,7 @@ module Sisimai::Bite::Email
216
214
 
217
215
  else
218
216
  # Before "message/rfc822"
219
- next if readcursor & Indicators[:deliverystatus] == 0
217
+ next if (readcursor & Indicators[:deliverystatus]).zero?
220
218
  next if e.empty?
221
219
 
222
220
  # Technical details of permanent failure:=20
@@ -272,13 +270,13 @@ module Sisimai::Bite::Email
272
270
  # the server for the recipient domain example.jp by mx.example.jp. [192.0.2.153].
273
271
  hostname = cv[1]
274
272
  ipv4addr = cv[2]
275
- if hostname =~ /[-0-9a-zA-Z]+[.][a-zA-Z]+\z/
276
- # Maybe valid hostname
277
- e['rhost'] = hostname.downcase
278
- else
279
- # Use IP address instead
280
- e['rhost'] = ipv4addr
281
- end
273
+ e['rhost'] = if hostname =~ /[-0-9a-zA-Z]+[.][a-zA-Z]+\z/
274
+ # Maybe valid hostname
275
+ hostname.downcase
276
+ else
277
+ # Use IP address instead
278
+ ipv4addr
279
+ end
282
280
  end
283
281
  end
284
282
 
@@ -299,14 +297,13 @@ module Sisimai::Bite::Email
299
297
  break
300
298
  end
301
299
  end
302
- e['status'] = Sisimai::SMTP::Status.find(e['diagnosis'])
300
+ next unless e['reason']
303
301
 
304
- if e['reason']
305
- # Set pseudo status code
306
- if e['status'] =~ /\A[45][.][1-7][.][1-9]\z/
307
- # Override bounce reason
308
- e['reason'] = Sisimai::SMTP::Status.name(e['status'])
309
- end
302
+ # Set pseudo status code
303
+ e['status'] = Sisimai::SMTP::Status.find(e['diagnosis'])
304
+ if e['status'] =~ /\A[45][.][1-7][.][1-9]\z/
305
+ # Override bounce reason
306
+ e['reason'] = Sisimai::SMTP::Status.name(e['status'])
310
307
  end
311
308
  end
312
309