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::V5sendmail parses a bounce email which created by
3
+ # Sendmail version 5.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module V5sendmail
3
- # Sisimai::Bite::Email::V5sendmail parses a bounce email which created by
4
- # Sendmail version 5.
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/V5sendmail.pm
8
8
  require 'sisimai/bite/email'
@@ -10,7 +10,7 @@ module Sisimai::Bite::Email
10
10
  Re0 = {
11
11
  :from => %r/\AMail Delivery Subsystem/,
12
12
  :subject => %r/\AReturned mail: [A-Z]/,
13
- }
13
+ }.freeze
14
14
  # Error text regular expressions which defined in src/savemail.c
15
15
  # savemail.c:485| (void) fflush(stdout);
16
16
  # savemail.c:486| p = queuename(e->e_parent, 'x');
@@ -36,7 +36,7 @@ module Sisimai::Bite::Email
36
36
  )[ ]-----
37
37
  }x,
38
38
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
39
- }
39
+ }.freeze
40
40
  Indicators = Sisimai::Bite::Email.INDICATORS
41
41
 
42
42
  def description; return 'Sendmail version 5'; end
@@ -81,7 +81,7 @@ module Sisimai::Bite::Email
81
81
  end
82
82
  end
83
83
 
84
- if readcursor & Indicators[:'message-rfc822'] == 0
84
+ if (readcursor & Indicators[:'message-rfc822']).zero?
85
85
  # Beginning of the original message part
86
86
  if e =~ Re1[:rfc822]
87
87
  readcursor |= Indicators[:'message-rfc822']
@@ -100,7 +100,7 @@ module Sisimai::Bite::Email
100
100
 
101
101
  else
102
102
  # Before "message/rfc822"
103
- next if readcursor & Indicators[:deliverystatus] == 0
103
+ next if (readcursor & Indicators[:deliverystatus]).zero?
104
104
  next if e.empty?
105
105
 
106
106
  # ----- Transcript of session follows -----
@@ -156,17 +156,17 @@ module Sisimai::Bite::Email
156
156
  end
157
157
  end
158
158
  end
159
- return nil if readcursor & Indicators[:'message-rfc822'] == 0
159
+ return nil if (readcursor & Indicators[:'message-rfc822']).zero?
160
160
 
161
161
  if recipients.zero?
162
162
  # Get the recipient address from the original message
163
163
  rfc822list.each do |e|
164
- if cv = e.match(/^To: (.+)$/m)
165
- # The value of To: header in the original message
166
- dscontents[0]['recipient'] = Sisimai::Address.s3s4(cv[1])
167
- recipients = 1
168
- break
169
- end
164
+ next unless cv = e.match(/^To: (.+)$/m)
165
+
166
+ # The value of To: header in the original message
167
+ dscontents[0]['recipient'] = Sisimai::Address.s3s4(cv[1])
168
+ recipients = 1
169
+ break
170
170
  end
171
171
  end
172
172
  return nil if recipients.zero?
@@ -177,14 +177,13 @@ module Sisimai::Bite::Email
177
177
  e['agent'] = self.smtpagent
178
178
  e['command'] = commandset[errorindex] || ''
179
179
 
180
- if anotherset['diagnosis'] && anotherset['diagnosis'].size > 0
181
- # Copy alternative error message
182
- e['diagnosis'] ||= anotherset['diagnosis']
183
-
184
- else
185
- # Set server response as a error message
186
- e['diagnosis'] ||= responding[errorindex]
187
- end
180
+ e['diagnosis'] ||= if anotherset['diagnosis'] && anotherset['diagnosis'].size > 0
181
+ # Copy alternative error message
182
+ anotherset['diagnosis']
183
+ else
184
+ # Set server response as a error message
185
+ responding[errorindex]
186
+ end
188
187
  e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
189
188
 
190
189
  unless e['recipient'] =~ /\A[^ ]+[@][^ ]+\z/
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Verizon parses a bounce email which created by
3
+ # Verizon Wireless.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module Verizon
3
- # Sisimai::Bite::Email::Verizon parses a bounce email which created by
4
- # Verizon Wireless.
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/Verizon.pm
8
8
  require 'sisimai/bite/email'
@@ -16,7 +16,7 @@ module Sisimai::Bite::Email
16
16
  :'from' => %r/[<]?sysadmin[@].+[.]vzwpix[.]com[>]?\z/,
17
17
  :'subject' => %r/Undeliverable Message/,
18
18
  },
19
- }
19
+ }.freeze
20
20
  Indicators = Sisimai::Bite::Email.INDICATORS
21
21
 
22
22
  def description; return 'Verizon Wireless: http://www.verizonwireless.com'; end
@@ -97,7 +97,7 @@ module Sisimai::Bite::Email
97
97
  end
98
98
  end
99
99
 
100
- if readcursor & Indicators[:'message-rfc822'] == 0
100
+ if (readcursor & Indicators[:'message-rfc822']).zero?
101
101
  # Beginning of the original message part
102
102
  if e =~ re1[:rfc822]
103
103
  readcursor |= Indicators[:'message-rfc822']
@@ -116,7 +116,7 @@ module Sisimai::Bite::Email
116
116
 
117
117
  else
118
118
  # Before "message/rfc822"
119
- next if readcursor & Indicators[:deliverystatus] == 0
119
+ next if (readcursor & Indicators[:deliverystatus]).zero?
120
120
  next if e.empty?
121
121
 
122
122
  # Message details:
@@ -176,7 +176,7 @@ module Sisimai::Bite::Email
176
176
  end
177
177
  end
178
178
 
179
- if readcursor & Indicators[:'message-rfc822'] == 0
179
+ if (readcursor & Indicators[:'message-rfc822']).zero?
180
180
  # Beginning of the original message part
181
181
  if e =~ re1[:rfc822]
182
182
  readcursor |= Indicators[:'message-rfc822']
@@ -195,7 +195,7 @@ module Sisimai::Bite::Email
195
195
 
196
196
  else
197
197
  # Before "message/rfc822"
198
- next if readcursor & Indicators[:deliverystatus] == 0
198
+ next if (readcursor & Indicators[:deliverystatus]).zero?
199
199
  next if e.empty?
200
200
 
201
201
  # Original Message:
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::X1 parses a bounce email which created by Unknown
3
+ # MTA #1. Methods in the module are called from only Sisimai::Message.
2
4
  module X1
3
- # Sisimai::Bite::Email::X1 parses a bounce email which created by Unknown
4
- # MTA #1. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/X1.pm
7
7
  require 'sisimai/bite/email'
@@ -9,12 +9,12 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/["]Mail Deliver System["] /,
11
11
  :subject => %r/\AReturned Mail: /,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/\AThe original message was received at (.+)\z/,
15
15
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
16
16
  :rfc822 => %r/\AReceived: from \d+[.]\d+[.]\d+[.]\d/,
17
- }
17
+ }.freeze
18
18
  Indicators = Sisimai::Bite::Email.INDICATORS
19
19
 
20
20
  def description; return 'Unknown MTA #1'; end
@@ -57,7 +57,7 @@ module Sisimai::Bite::Email
57
57
  end
58
58
  end
59
59
 
60
- if readcursor & Indicators[:'message-rfc822'] == 0
60
+ if (readcursor & Indicators[:'message-rfc822']).zero?
61
61
  # Beginning of the original message part
62
62
  if e =~ Re1[:rfc822]
63
63
  readcursor |= Indicators[:'message-rfc822']
@@ -76,7 +76,7 @@ module Sisimai::Bite::Email
76
76
 
77
77
  else
78
78
  # Before "message/rfc822"
79
- next if readcursor & Indicators[:deliverystatus] == 0
79
+ next if (readcursor & Indicators[:deliverystatus]).zero?
80
80
  next if e.empty?
81
81
 
82
82
  # The original message was received at Thu, 29 Apr 2010 23:34:45 +0900 (JST)
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::X2 parses a bounce email which created by Unknown
3
+ # MTA #2. Methods in the module are called from only Sisimai::Message.
2
4
  module X2
3
- # Sisimai::Bite::Email::X2 parses a bounce email which created by Unknown
4
- # MTA #2. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/X2.pm
7
7
  require 'sisimai/bite/email'
@@ -13,12 +13,12 @@ module Sisimai::Bite::Email
13
13
  |fail(?:ure|ed)[ ]delivery
14
14
  )
15
15
  }x,
16
- }
16
+ }.freeze
17
17
  Re1 = {
18
18
  :begin => %r/\AUnable to deliver message to the following address/,
19
19
  :rfc822 => %r/\A--- Original message follows/,
20
20
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
21
- }
21
+ }.freeze
22
22
  Indicators = Sisimai::Bite::Email.INDICATORS
23
23
 
24
24
  def description; return 'Unknown MTA #2'; end
@@ -60,7 +60,7 @@ module Sisimai::Bite::Email
60
60
  end
61
61
  end
62
62
 
63
- if readcursor & Indicators[:'message-rfc822'] == 0
63
+ if (readcursor & Indicators[:'message-rfc822']).zero?
64
64
  # Beginning of the original message part
65
65
  if e =~ Re1[:rfc822]
66
66
  readcursor |= Indicators[:'message-rfc822']
@@ -79,7 +79,7 @@ module Sisimai::Bite::Email
79
79
 
80
80
  else
81
81
  # Before "message/rfc822"
82
- next if readcursor & Indicators[:deliverystatus] == 0
82
+ next if (readcursor & Indicators[:deliverystatus]).zero?
83
83
  next if e.empty?
84
84
 
85
85
  # Message from example.com.
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::X3 parses a bounce email which created by Unknown
3
+ # MTA #3. Methods in the module are called from only Sisimai::Message.
2
4
  module X3
3
- # Sisimai::Bite::Email::X3 parses a bounce email which created by Unknown
4
- # MTA #3. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/X3.pm
7
7
  require 'sisimai/bite/email'
@@ -9,12 +9,12 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/\AMail Delivery System/,
11
11
  :subject => %r/\ADelivery status notification/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/\A[ \t]+This is an automatically generated Delivery Status Notification/,
15
15
  :rfc822 => %r|\AContent-Type: message/rfc822|,
16
16
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
17
- }
17
+ }.freeze
18
18
  Indicators = Sisimai::Bite::Email.INDICATORS
19
19
 
20
20
  def description; return 'Unknown MTA #3'; end
@@ -56,7 +56,7 @@ module Sisimai::Bite::Email
56
56
  end
57
57
  end
58
58
 
59
- if readcursor & Indicators[:'message-rfc822'] == 0
59
+ if (readcursor & Indicators[:'message-rfc822']).zero?
60
60
  # Beginning of the original message part
61
61
  if e =~ Re1[:rfc822]
62
62
  readcursor |= Indicators[:'message-rfc822']
@@ -75,7 +75,7 @@ module Sisimai::Bite::Email
75
75
 
76
76
  else
77
77
  # Before "message/rfc822"
78
- next if readcursor & Indicators[:deliverystatus] == 0
78
+ next if (readcursor & Indicators[:deliverystatus]).zero?
79
79
  next if e.empty?
80
80
 
81
81
  # ============================================================================
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::X4 parses a bounce email which created by some qmail
3
+ # clone. Methods in the module are called from only Sisimai::Message.
2
4
  module X4
3
- # Sisimai::Bite::Email::X4 parses a bounce email which created by some qmail
4
- # clone. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/X4.pm
7
7
  # MTA module for qmail clones
@@ -14,7 +14,7 @@ module Sisimai::Bite::Email
14
14
  )
15
15
  }xi,
16
16
  :received => %r/\A[(]qmail[ ]+\d+[ ]+invoked[ ]+for[ ]+bounce[)]/,
17
- }
17
+ }.freeze
18
18
  # qmail-remote.c:248| if (code >= 500) {
19
19
  # qmail-remote.c:249| out("h"); outhost(); out(" does not like recipient.\n");
20
20
  # qmail-remote.c:265| if (code >= 500) quit("D"," failed on DATA command");
@@ -49,7 +49,7 @@ module Sisimai::Bite::Email
49
49
  :error => %r/\ARemote host said:/,
50
50
  :sorry => %r/\A[Ss]orry[,.][ ]/,
51
51
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
52
- }
52
+ }.freeze
53
53
  ReSMTP = {
54
54
  # Error text regular expressions which defined in qmail-remote.c
55
55
  # qmail-remote.c:225| if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
@@ -72,7 +72,7 @@ module Sisimai::Bite::Email
72
72
  |(?:Error:)?.+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
73
73
  )
74
74
  }x,
75
- }
75
+ }.freeze
76
76
  # qmail-remote.c:261| if (!flagbother) quit("DGiving up on ","");
77
77
  ReHost = %r{(?:
78
78
  Giving[ ]up[ ]on[ ](.+[0-9a-zA-Z])[.]?\z
@@ -105,7 +105,7 @@ module Sisimai::Bite::Email
105
105
  )
106
106
  )
107
107
  }x,
108
- }
108
+ }.freeze
109
109
  # userunknown + expired
110
110
  ReOnHold = %r/\A[^ ]+ does not like recipient[.][ ]+.+this message has been in the queue too long[.]\z/
111
111
  # qmail-remote-fallback.patch
@@ -139,7 +139,7 @@ module Sisimai::Bite::Email
139
139
  )
140
140
  }x,
141
141
  systemfull: %r/Requested action not taken: mailbox unavailable [(]not enough free space[)]/,
142
- }
142
+ }.freeze
143
143
  # qmail-send.c:922| ... (&dline[c],"I'm not going to try again; this message has been in the queue too long.\n")) nomem();
144
144
  ReDelayed = %r/this[ ]message[ ]has[ ]been[ ]in[ ]the[ ]queue[ ]too[ ]long[.]\z/x
145
145
  Indicators = Sisimai::Bite::Email.INDICATORS
@@ -190,7 +190,7 @@ module Sisimai::Bite::Email
190
190
  end
191
191
  end
192
192
 
193
- if readcursor & Indicators[:'message-rfc822'] == 0
193
+ if (readcursor & Indicators[:'message-rfc822']).zero?
194
194
  # Beginning of the original message part
195
195
  if e =~ Re1[:rfc822]
196
196
  readcursor |= Indicators[:'message-rfc822']
@@ -209,7 +209,7 @@ module Sisimai::Bite::Email
209
209
 
210
210
  else
211
211
  # Before "message/rfc822"
212
- next if readcursor & Indicators[:deliverystatus] == 0
212
+ next if (readcursor & Indicators[:deliverystatus]).zero?
213
213
  next if e.empty?
214
214
 
215
215
  # <kijitora@example.jp>:
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::X5 parses a bounce email which created by Unknown
3
+ # MTA #5. Methods in the module are called from only Sisimai::Message.
2
4
  module X5
3
- # Sisimai::Bite::Email::X5 parses a bounce email which created by Unknown
4
- # MTA #5. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/X5.pm
7
7
  require 'sisimai/bite/email'
@@ -9,12 +9,12 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :from => %r/\bTWFpbCBEZWxpdmVyeSBTdWJzeXN0ZW0\b/,
11
11
  :to => %r/\bNotificationRecipients\b/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r|\AContent-Type: message/delivery-status|,
15
15
  :rfc822 => %r|\AContent-Type: message/rfc822|,
16
16
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
17
- }
17
+ }.freeze
18
18
  Indicators = Sisimai::Bite::Email.INDICATORS
19
19
 
20
20
  def description; return 'Unknown MTA #5'; end
@@ -82,7 +82,7 @@ module Sisimai::Bite::Email
82
82
  end
83
83
  end
84
84
 
85
- if readcursor & Indicators[:'message-rfc822'] == 0
85
+ if (readcursor & Indicators[:'message-rfc822']).zero?
86
86
  # Beginning of the original message part
87
87
  if e =~ Re1[:rfc822]
88
88
  readcursor |= Indicators[:'message-rfc822']
@@ -148,7 +148,7 @@ module Sisimai::Bite::Email
148
148
  else
149
149
  # After "message/rfc822"
150
150
  next if recipients.zero?
151
- next if readcursor & Indicators['deliverystatus'] == 0
151
+ next if (readcursor & Indicators['deliverystatus']).zero?
152
152
 
153
153
  if e.empty?
154
154
  blanklines += 1
@@ -1,19 +1,19 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Yahoo parses a bounce email which created by Yahoo!
3
+ # MAIL. Methods in the module are called from only Sisimai::Message.
2
4
  module Yahoo
3
- # Sisimai::Bite::Email::Yahoo parses a bounce email which created by Yahoo!
4
- # MAIL. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Yahoo.pm
7
7
  require 'sisimai/bite/email'
8
8
 
9
9
  Re0 = {
10
10
  :subject => %r/\AFailure Notice\z/,
11
- }
11
+ }.freeze
12
12
  Re1 = {
13
13
  :begin => %r/\ASorry, we were unable to deliver your message/,
14
14
  :rfc822 => %r/\A--- Below this line is a copy of the message[.]\z/,
15
15
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
16
- }
16
+ }.freeze
17
17
  Indicators = Sisimai::Bite::Email.INDICATORS
18
18
 
19
19
  def description; return 'Yahoo! MAIL: https://www.yahoo.com'; end
@@ -59,7 +59,7 @@ module Sisimai::Bite::Email
59
59
  end
60
60
  end
61
61
 
62
- if readcursor & Indicators[:'message-rfc822'] == 0
62
+ if (readcursor & Indicators[:'message-rfc822']).zero?
63
63
  # Beginning of the original message part
64
64
  if e =~ Re1[:rfc822]
65
65
  readcursor |= Indicators[:'message-rfc822']
@@ -78,7 +78,7 @@ module Sisimai::Bite::Email
78
78
 
79
79
  else
80
80
  # Before "message/rfc822"
81
- next if readcursor & Indicators[:deliverystatus] == 0
81
+ next if (readcursor & Indicators[:deliverystatus]).zero?
82
82
  next if e.empty?
83
83
 
84
84
  # Sorry, we were unable to deliver your message to the following address.
@@ -98,7 +98,7 @@ module Sisimai::Bite::Email
98
98
  recipients += 1
99
99
 
100
100
  else
101
- if e =~ /\ARemote host said:/
101
+ if e.start_with?('Remote host said:')
102
102
  # Remote host said: 550 5.1.1 <kijitora@example.org>... User Unknown [RCPT_TO]
103
103
  v['diagnosis'] = e
104
104
 
@@ -1,19 +1,19 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Yandex parses a bounce email which created by
3
+ # Yandex.Mail. Methods in the module are called from only Sisimai::Message.
2
4
  module Yandex
3
- # Sisimai::Bite::Email::Yandex parses a bounce email which created by
4
- # Yandex.Mail. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Yandex.pm
7
7
  require 'sisimai/bite/email'
8
8
 
9
9
  Re0 = {
10
10
  :from => %r/\Amailer-daemon[@]yandex[.]ru\z/,
11
- }
11
+ }.freeze
12
12
  Re1 = {
13
13
  :begin => %r/\AThis is the mail system at host yandex[.]ru[.]/,
14
14
  :rfc822 => %r|\AContent-Type: message/rfc822|,
15
15
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
16
- }
16
+ }.freeze
17
17
  Indicators = Sisimai::Bite::Email.INDICATORS
18
18
 
19
19
  def description; return 'Yandex.Mail: http://www.yandex.ru'; end
@@ -54,7 +54,7 @@ module Sisimai::Bite::Email
54
54
  readcursor = 0 # (Integer) Points the current cursor position
55
55
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
56
56
  commandset = [] # (Array) ``in reply to * command'' list
57
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
57
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
58
58
  connheader = {
59
59
  'date' => '', # The value of Arrival-Date header
60
60
  'lhost' => '', # The value of Reporting-MTA header
@@ -74,7 +74,7 @@ module Sisimai::Bite::Email
74
74
  end
75
75
  end
76
76
 
77
- if readcursor & Indicators[:'message-rfc822'] == 0
77
+ if (readcursor & Indicators[:'message-rfc822']).zero?
78
78
  # Beginning of the original message part
79
79
  if e =~ Re1[:rfc822]
80
80
  readcursor |= Indicators[:'message-rfc822']
@@ -93,7 +93,7 @@ module Sisimai::Bite::Email
93
93
 
94
94
  else
95
95
  # Before "message/rfc822"
96
- next if readcursor & Indicators[:deliverystatus] == 0
96
+ next if (readcursor & Indicators[:deliverystatus]).zero?
97
97
  next if e.empty?
98
98
 
99
99
  if connvalues == connheader.keys.size