sisimai 4.22.1-java → 4.22.2-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 (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 +11 -5
  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,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::McAfee parses a bounce email which created by McAfee
3
+ # Email Appliance. Methods in the module are called from only Sisimai::Message.
2
4
  module McAfee
3
- # Sisimai::Bite::Email::McAfee parses a bounce email which created by McAfee
4
- # Email Appliance. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/McAfee.pm
7
7
  require 'sisimai/bite/email'
@@ -9,20 +9,20 @@ module Sisimai::Bite::Email
9
9
  Re0 = {
10
10
  :'x-nai' => %r/Modified by McAfee /,
11
11
  :'subject' => %r/\ADelivery Status\z/,
12
- }
12
+ }.freeze
13
13
  Re1 = {
14
14
  :begin => %r/[-]+ The following addresses had delivery problems [-]+\z/,
15
15
  :error => %r|\AContent-Type: [^ ]+/[^ ]+; name="deliveryproblems[.]txt"|,
16
16
  :rfc822 => %r|\AContent-Type: message/rfc822\z|,
17
17
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
18
- }
18
+ }.freeze
19
19
  ReFailure = {
20
20
  userunknown: %r{(?:
21
21
  User[ ][(].+[@].+[)][ ]unknown[.]
22
22
  |550[ ]Unknown[ ]user[ ][^ ]+[@][^ ]+
23
23
  )
24
24
  }x,
25
- }
25
+ }.freeze
26
26
  Indicators = Sisimai::Bite::Email.INDICATORS
27
27
 
28
28
  def description; return 'McAfee Email Appliance'; end
@@ -72,7 +72,7 @@ module Sisimai::Bite::Email
72
72
  end
73
73
  end
74
74
 
75
- if readcursor & Indicators[:'message-rfc822'] == 0
75
+ if (readcursor & Indicators[:'message-rfc822']).zero?
76
76
  # Beginning of the original message part
77
77
  if e =~ Re1[:rfc822]
78
78
  readcursor |= Indicators[:'message-rfc822']
@@ -91,7 +91,7 @@ module Sisimai::Bite::Email
91
91
 
92
92
  else
93
93
  # Before "message/rfc822"
94
- next if readcursor & Indicators[:deliverystatus] == 0
94
+ next if (readcursor & Indicators[:deliverystatus]).zero?
95
95
  next if e.empty?
96
96
 
97
97
  # Content-Type: text/plain; name="deliveryproblems.txt"
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::MessageLabs parses a bounce email which created by
3
+ # Symantec.cloud: formerly MessageLabs. Methods in the module are called
4
+ # from only Sisimai::Message.
2
5
  module MessageLabs
3
- # Sisimai::Bite::Email::MessageLabs parses a bounce email which created by
4
- # Symantec.cloud: formerly MessageLabs. Methods in the module are called
5
- # from only Sisimai::Message.
6
6
  class << self
7
7
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/MessageLabs.pm
8
8
  require 'sisimai/bite/email'
@@ -10,16 +10,16 @@ module Sisimai::Bite::Email
10
10
  Re0 = {
11
11
  :from => %r/MAILER-DAEMON[@]messagelabs[.]com/,
12
12
  :subject => %r/\AMail Delivery Failure/,
13
- }
13
+ }.freeze
14
14
  Re1 = {
15
15
  :begin => %r|\AContent-Type: message/delivery-status|,
16
16
  :error => %r/\AReason:[ \t]*(.+)\z/,
17
17
  :rfc822 => %r|\AContent-Type: text/rfc822-headers\z|,
18
18
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
19
- }
19
+ }.freeze
20
20
  ReFailure = {
21
21
  userunknown: %r/No[ ]such[ ]user/x,
22
- }
22
+ }.freeze
23
23
  Indicators = Sisimai::Bite::Email.INDICATORS
24
24
 
25
25
  def description; return 'Symantec.cloud http://www.messagelabs.com'; end
@@ -59,7 +59,7 @@ module Sisimai::Bite::Email
59
59
  readcursor = 0 # (Integer) Points the current cursor position
60
60
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
61
61
  commandset = [] # (Array) ``in reply to * command'' list
62
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
62
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
63
63
  connheader = {
64
64
  'date' => '', # The value of Arrival-Date header
65
65
  'lhost' => '', # The value of Reporting-MTA header
@@ -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
  next if e.empty?
103
103
 
104
104
  if connvalues == connheader.keys.size
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::MessagingServer parses a bounce email which created
3
+ # by Oracle Communications Messaging Server and Sun Java System Messaging
4
+ # Server. Methods in the module are called from only Sisimai::Message.
2
5
  module MessagingServer
3
- # Sisimai::Bite::Email::MessagingServer parses a bounce email which created
4
- # by Oracle Communications Messaging Server and Sun Java System Messaging
5
- # Server. Methods in the module are called from only Sisimai::Message.
6
6
  class << self
7
7
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/MessagingServer.pm
8
8
  require 'sisimai/bite'
@@ -12,15 +12,15 @@ module Sisimai::Bite::Email
12
12
  :subject => %r/\ADelivery Notification: /,
13
13
  :received => %r/[ ][(]MessagingServer[)][ ]with[ ]/,
14
14
  :boundary => %r/Boundary_[(]ID_.+[)]/,
15
- }
15
+ }.freeze
16
16
  Re1 = {
17
17
  :begin => %r/\AThis report relates to a message you sent with the following header fields:/,
18
18
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
19
19
  :rfc822 => %r!\A(?:Content-type:[ ]*message/rfc822|Return-path:[ ]*)!x,
20
- }
20
+ }.freeze
21
21
  ReFailure = {
22
22
  hostunknown: %r|Illegal[ ]host/domain[ ]name[ ]found|x,
23
- }
23
+ }.freeze
24
24
  Indicators = Sisimai::Bite::Email.INDICATORS
25
25
 
26
26
  def description; return 'Oracle Communications Messaging Server'; end
@@ -66,7 +66,7 @@ module Sisimai::Bite::Email
66
66
  end
67
67
  end
68
68
 
69
- if readcursor & Indicators[:'message-rfc822'] == 0
69
+ if (readcursor & Indicators[:'message-rfc822']).zero?
70
70
  # Beginning of the original message part
71
71
  if e =~ Re1[:rfc822]
72
72
  readcursor |= Indicators[:'message-rfc822']
@@ -85,7 +85,7 @@ module Sisimai::Bite::Email
85
85
 
86
86
  else
87
87
  # Before "message/rfc822"
88
- next if readcursor & Indicators[:deliverystatus] == 0
88
+ next if (readcursor & Indicators[:deliverystatus]).zero?
89
89
  next if e.empty?
90
90
 
91
91
  # --Boundary_(ID_0000000000000000000000)
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::mFILTER parses a bounce email which created by
3
+ # Digital Arts m-FILTER.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module MFILTER
3
- # Sisimai::Bite::Email::mFILTER parses a bounce email which created by
4
- # Digital Arts m-FILTER.
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/mFILTER.pm
8
8
  require 'sisimai/bite/email'
@@ -11,14 +11,14 @@ module Sisimai::Bite::Email
11
11
  :'from' => %r/\AMailer Daemon [<]MAILER-DAEMON[@]/,
12
12
  :'subject' => %r/\Afailure notice\z/,
13
13
  :'x-mailer' => %r/\Am-FILTER\z/,
14
- }
14
+ }.freeze
15
15
  Re1 = {
16
16
  :begin => %r/\A[^ ]+[@][^ ]+[.][a-zA-Z]+\z/,
17
17
  :error => %r/\A-------server message\z/,
18
18
  :command => %r/\A-------SMTP command\z/,
19
19
  :rfc822 => %r/\A-------original (?:message|mail info)\z/,
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 'Digital Arts m-FILTER'; end
@@ -59,7 +59,7 @@ module Sisimai::Bite::Email
59
59
  readcursor |= Indicators[:deliverystatus] if e =~ Re1[:begin]
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
  # このメールは「m-FILTER」が自動的に生成して送信しています。
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::MXLogic parses a bounce email which created by
3
+ # McAfee SaaS (formerly MX Logic).
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module MXLogic
3
- # Sisimai::Bite::Email::MXLogic parses a bounce email which created by
4
- # McAfee SaaS (formerly MX Logic).
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/MXLogic.pm
8
8
  # Based on Sisimai::Bite::Email::Exim
@@ -17,16 +17,16 @@ module Sisimai::Bite::Email
17
17
  )
18
18
  }x,
19
19
  :'message-id' => %r/\A[<]mxl[~][0-9a-f]+/,
20
- }
20
+ }.freeze
21
21
  Re1 = {
22
22
  :rfc822 => %r/\AIncluded is a copy of the message header:\z/,
23
23
  :begin => %r/\AThis message was created automatically by mail delivery software[.]\z/,
24
24
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
25
- }
25
+ }.freeze
26
26
  ReCommand = [
27
27
  %r/SMTP error from remote (?:mail server|mailer) after ([A-Za-z]{4})/,
28
28
  %r/SMTP error from remote (?:mail server|mailer) after end of ([A-Za-z]{4})/,
29
- ]
29
+ ].freeze
30
30
  ReFailure = {
31
31
  userunknown: %r{
32
32
  user[ ]not[ ]found
@@ -58,7 +58,7 @@ module Sisimai::Bite::Email
58
58
  contenterror: %r{
59
59
  Too[ ]many[ ]["]Received["][ ]headers
60
60
  }x,
61
- }
61
+ }.freeze
62
62
  ReDelayed = %r{(?:
63
63
  retry[ ]timeout[ ]exceeded
64
64
  |No[ ]action[ ]is[ ]required[ ]on[ ]your[ ]part
@@ -119,7 +119,7 @@ module Sisimai::Bite::Email
119
119
  end
120
120
  end
121
121
 
122
- if readcursor & Indicators[:'message-rfc822'] == 0
122
+ if (readcursor & Indicators[:'message-rfc822']).zero?
123
123
  # Beginning of the original message part
124
124
  if e =~ Re1[:rfc822]
125
125
  readcursor |= Indicators[:'message-rfc822']
@@ -138,7 +138,7 @@ module Sisimai::Bite::Email
138
138
 
139
139
  else
140
140
  # Before "message/rfc822"
141
- next if readcursor & Indicators[:deliverystatus] == 0
141
+ next if (readcursor & Indicators[:deliverystatus]).zero?
142
142
  next if e.empty?
143
143
 
144
144
  # This message was created automatically by mail delivery software.
@@ -1,19 +1,19 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::::Email::Notes parses a bounce email which created by Lotus
3
+ # Notes Server. Methods in the module are called from only Sisimai::Message.
2
4
  module Notes
3
- # Sisimai::Bite::::Email::Notes parses a bounce email which created by Lotus
4
- # Notes Server. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Notes.pm
7
7
  require 'sisimai/bite/email'
8
8
 
9
9
  Re0 = {
10
10
  :'subject' => %r/\AUndeliverable message/,
11
- }
11
+ }.freeze
12
12
  Re1 = {
13
13
  :begin => %r/\A[-]+[ ]+Failure Reasons[ ]+[-]+\z/,
14
14
  :rfc822 => %r/^[-]+[ ]+Returned Message[ ]+[-]+$/,
15
15
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
16
- }
16
+ }.freeze
17
17
  ReFailure = {
18
18
  userunknown: %r{(?:
19
19
  User[ ]not[ ]listed[ ]in[ ]public[ ]Name[ ][&][ ]Address[ ]Book
@@ -21,7 +21,7 @@ module Sisimai::Bite::Email
21
21
  )
22
22
  }x,
23
23
  networkerror: %r/Message has exceeded maximum hop count/,
24
- }
24
+ }.freeze
25
25
  Indicators = Sisimai::Bite::Email.INDICATORS
26
26
 
27
27
  def description; return 'Lotus Notes'; end
@@ -65,7 +65,7 @@ module Sisimai::Bite::Email
65
65
  end
66
66
  end
67
67
 
68
- if readcursor & Indicators[:'message-rfc822'] == 0
68
+ if (readcursor & Indicators[:'message-rfc822']).zero?
69
69
  # Beginning of the original message part
70
70
  if e =~ Re1[:rfc822]
71
71
  readcursor |= Indicators[:'message-rfc822']
@@ -92,7 +92,7 @@ module Sisimai::Bite::Email
92
92
 
93
93
  else
94
94
  # Before "message/rfc822"
95
- next if readcursor & Indicators[:deliverystatus] == 0
95
+ next if (readcursor & Indicators[:deliverystatus]).zero?
96
96
 
97
97
  # ------- Failure Reasons --------
98
98
  #
@@ -143,11 +143,11 @@ module Sisimai::Bite::Email
143
143
  if recipients.zero?
144
144
  # Fallback: Get the recpient address from RFC822 part
145
145
  rfc822list.each do |e|
146
- if cv = e.match(/^To:[ ]*(.+)$/m)
147
- v['recipient'] = Sisimai::Address.s3s4(cv[1])
148
- recipients += 1 if v['recipient'].size > 0
149
- break
150
- end
146
+ next unless cv = e.match(/^To:[ ]*(.+)$/m)
147
+
148
+ v['recipient'] = Sisimai::Address.s3s4(cv[1])
149
+ recipients += 1 if v['recipient'].size > 0
150
+ break
151
151
  end
152
152
  end
153
153
 
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Office365 parses a bounce email which created by
3
+ # Microsoft Office 365.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module Office365
3
- # Sisimai::Bite::Email::Office365 parses a bounce email which created by
4
- # Microsoft Office 365.
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/Office365.pm
8
8
  require 'sisimai/bite/email'
@@ -11,7 +11,7 @@ module Sisimai::Bite::Email
11
11
  :'subject' => %r/Undeliverable:/,
12
12
  :'received' => %r/.+[.](?:outbound[.]protection|prod)[.]outlook[.]com\b/,
13
13
  :'message-id' => %r/.+[.](?:outbound[.]protection|prod)[.]outlook[.]com\b/,
14
- }
14
+ }.freeze
15
15
  Re1 = {
16
16
  :begin => %r{\A(?:
17
17
  Delivery[ ]has[ ]failed[ ]to[ ]these[ ]recipients[ ]or[ ]groups:
@@ -22,7 +22,7 @@ module Sisimai::Bite::Email
22
22
  :eoerr => %r/\AOriginal message headers:\z/,
23
23
  :rfc822 => %r|\AContent-Type: message/rfc822\z|,
24
24
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
25
- }
25
+ }.freeze
26
26
  CodeTable = {
27
27
  # https://support.office.com/en-us/article/Email-non-delivery-reports-in-Office-365-51daa6b9-2e35-49c4-a0c9-df85bf8533c3
28
28
  %r/\A4[.]4[.]7\z/ => 'expired',
@@ -49,7 +49,7 @@ module Sisimai::Bite::Email
49
49
  %r/\A5[.]7[.]60[6-9]\z/ => 'blocked',
50
50
  %r/\A5[.]7[.]6[1-4]\d\z/ => 'blocked',
51
51
  %r/\A5[.]7[.]7[0-4]\d\z/ => 'toomanyconn',
52
- }
52
+ }.freeze
53
53
  Indicators = Sisimai::Bite::Email.INDICATORS
54
54
 
55
55
  def description; return 'Microsoft Office 365: http://office.microsoft.com/'; end
@@ -126,7 +126,7 @@ module Sisimai::Bite::Email
126
126
  end
127
127
  end
128
128
 
129
- if readcursor & Indicators[:'message-rfc822'] == 0
129
+ if (readcursor & Indicators[:'message-rfc822']).zero?
130
130
  # Beginning of the original message part
131
131
  if e =~ Re1[:rfc822]
132
132
  readcursor |= Indicators[:'message-rfc822']
@@ -145,7 +145,7 @@ module Sisimai::Bite::Email
145
145
 
146
146
  else
147
147
  # Before "message/rfc822"
148
- next if readcursor & Indicators[:deliverystatus] == 0
148
+ next if (readcursor & Indicators[:deliverystatus]).zero?
149
149
  next if e.empty?
150
150
 
151
151
  # kijitora@example.com<mailto:kijitora@example.com>
@@ -241,14 +241,13 @@ module Sisimai::Bite::Email
241
241
  pseudostatus = Sisimai::SMTP::Status.find(e['diagnosis'])
242
242
  e['status'] = pseudostatus if pseudostatus.size > 0
243
243
  end
244
+ next unless e['status']
244
245
 
245
- if e['status']
246
- CodeTable.each_key do |f|
247
- # Try to match with each key as a regular expression
248
- next unless e['status'] =~ f
249
- e['reason'] = CodeTable[f]
250
- break
251
- end
246
+ CodeTable.each_key do |f|
247
+ # Try to match with each key as a regular expression
248
+ next unless e['status'] =~ f
249
+ e['reason'] = CodeTable[f]
250
+ break
252
251
  end
253
252
  end
254
253
 
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::OpenSMTPD parses a bounce email which created by
3
+ # OpenSMTPD. Methods in the module are called from only Sisimai::Message.
2
4
  module OpenSMTPD
3
- # Sisimai::Bite::Email::OpenSMTPD parses a bounce email which created by
4
- # OpenSMTPD. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/OpenSMTPD.pm
7
7
  require 'sisimai/bite/email'
@@ -10,7 +10,7 @@ module Sisimai::Bite::Email
10
10
  :from => %r/\AMailer Daemon [<][^ ]+[@]/,
11
11
  :subject => %r/\ADelivery status notification/,
12
12
  :received => %r/[ ][(]OpenSMTPD[)][ ]with[ ]/,
13
- }
13
+ }.freeze
14
14
  # http://www.openbsd.org/cgi-bin/man.cgi?query=smtpd&sektion=8
15
15
  # opensmtpd-5.4.2p1/smtpd/
16
16
  # bounce.c/317:#define NOTICE_INTRO \
@@ -40,7 +40,7 @@ module Sisimai::Bite::Email
40
40
  :begin => %r/\A[ \t]*This is the MAILER-DAEMON, please DO NOT REPLY to this e[-]?mail[.]\z/,
41
41
  :rfc822 => %r/\A[ \t]*Below is a copy of the original message:\z/,
42
42
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
43
- }
43
+ }.freeze
44
44
  ReFailure = {
45
45
  expired: %r{
46
46
  # smtpd/queue.c:221| envelope_set_errormsg(&evp, "Envelope expired");
@@ -76,7 +76,7 @@ module Sisimai::Bite::Email
76
76
  # smtpd/mta.c:1013| relay->failstr = "Could not retrieve credentials";
77
77
  Could[ ]not[ ]retrieve[ ]credentials
78
78
  }x,
79
- }
79
+ }.freeze
80
80
  Indicators = Sisimai::Bite::Email.INDICATORS
81
81
 
82
82
  def description; return 'OpenSMTPD'; end
@@ -119,7 +119,7 @@ module Sisimai::Bite::Email
119
119
  end
120
120
  end
121
121
 
122
- if readcursor & Indicators[:'message-rfc822'] == 0
122
+ if (readcursor & Indicators[:'message-rfc822']).zero?
123
123
  # Beginning of the original message part
124
124
  if e =~ Re1[:rfc822]
125
125
  readcursor |= Indicators[:'message-rfc822']
@@ -138,7 +138,7 @@ module Sisimai::Bite::Email
138
138
 
139
139
  else
140
140
  # Before "message/rfc822"
141
- next if readcursor & Indicators[:deliverystatus] == 0
141
+ next if (readcursor & Indicators[:deliverystatus]).zero?
142
142
  next if e.empty?
143
143
 
144
144
  # Hi!