sisimai 4.25.4-java → 4.25.5-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 +5 -5
  2. data/.travis.yml +2 -2
  3. data/ChangeLog.md +50 -0
  4. data/README-JA.md +10 -37
  5. data/README.md +10 -37
  6. data/lib/sisimai.rb +15 -64
  7. data/lib/sisimai/address.rb +13 -17
  8. data/lib/sisimai/arf.rb +4 -4
  9. data/lib/sisimai/data.rb +3 -5
  10. data/lib/sisimai/lhost.rb +0 -14
  11. data/lib/sisimai/lhost/activehunter.rb +31 -55
  12. data/lib/sisimai/lhost/amavis.rb +41 -66
  13. data/lib/sisimai/lhost/amazonses.rb +189 -235
  14. data/lib/sisimai/lhost/amazonworkmail.rb +48 -71
  15. data/lib/sisimai/lhost/aol.rb +49 -75
  16. data/lib/sisimai/lhost/apachejames.rb +60 -83
  17. data/lib/sisimai/lhost/bigfoot.rb +61 -85
  18. data/lib/sisimai/lhost/biglobe.rb +40 -62
  19. data/lib/sisimai/lhost/courier.rb +60 -82
  20. data/lib/sisimai/lhost/domino.rb +50 -76
  21. data/lib/sisimai/lhost/einsundeins.rb +57 -55
  22. data/lib/sisimai/lhost/exchange2003.rb +79 -101
  23. data/lib/sisimai/lhost/exchange2007.rb +66 -74
  24. data/lib/sisimai/lhost/exim.rb +119 -142
  25. data/lib/sisimai/lhost/ezweb.rb +53 -73
  26. data/lib/sisimai/lhost/facebook.rb +49 -75
  27. data/lib/sisimai/lhost/fml.rb +25 -50
  28. data/lib/sisimai/lhost/gmx.rb +55 -79
  29. data/lib/sisimai/lhost/google.rb +39 -66
  30. data/lib/sisimai/lhost/gsuite.rb +74 -94
  31. data/lib/sisimai/lhost/imailserver.rb +34 -67
  32. data/lib/sisimai/lhost/interscanmss.rb +33 -67
  33. data/lib/sisimai/lhost/kddi.rb +30 -52
  34. data/lib/sisimai/lhost/mailfoundry.rb +35 -57
  35. data/lib/sisimai/lhost/mailmarshalsmtp.rb +66 -89
  36. data/lib/sisimai/lhost/mailru.rb +51 -76
  37. data/lib/sisimai/lhost/mcafee.rb +53 -79
  38. data/lib/sisimai/lhost/messagelabs.rb +49 -75
  39. data/lib/sisimai/lhost/messagingserver.rb +91 -113
  40. data/lib/sisimai/lhost/mfilter.rb +50 -70
  41. data/lib/sisimai/lhost/mxlogic.rb +38 -63
  42. data/lib/sisimai/lhost/notes.rb +53 -82
  43. data/lib/sisimai/lhost/office365.rb +64 -81
  44. data/lib/sisimai/lhost/opensmtpd.rb +30 -52
  45. data/lib/sisimai/lhost/outlook.rb +49 -75
  46. data/lib/sisimai/lhost/postfix.rb +116 -117
  47. data/lib/sisimai/lhost/qmail.rb +33 -55
  48. data/lib/sisimai/lhost/receivingses.rb +49 -75
  49. data/lib/sisimai/lhost/sendgrid.rb +68 -203
  50. data/lib/sisimai/lhost/sendmail.rb +101 -125
  51. data/lib/sisimai/lhost/surfcontrol.rb +53 -79
  52. data/lib/sisimai/lhost/userdefined.rb +15 -35
  53. data/lib/sisimai/lhost/v5sendmail.rb +59 -89
  54. data/lib/sisimai/lhost/verizon.rb +75 -124
  55. data/lib/sisimai/lhost/x1.rb +30 -54
  56. data/lib/sisimai/lhost/x2.rb +28 -52
  57. data/lib/sisimai/lhost/x3.rb +44 -68
  58. data/lib/sisimai/lhost/x4.rb +34 -58
  59. data/lib/sisimai/lhost/x5.rb +42 -70
  60. data/lib/sisimai/lhost/yahoo.rb +44 -68
  61. data/lib/sisimai/lhost/yandex.rb +59 -85
  62. data/lib/sisimai/lhost/zoho.rb +54 -78
  63. data/lib/sisimai/mail.rb +5 -9
  64. data/lib/sisimai/mail/maildir.rb +10 -14
  65. data/lib/sisimai/mail/mbox.rb +8 -12
  66. data/lib/sisimai/mail/memory.rb +5 -9
  67. data/lib/sisimai/mail/stdin.rb +7 -11
  68. data/lib/sisimai/mda.rb +2 -2
  69. data/lib/sisimai/message.rb +51 -154
  70. data/lib/sisimai/mime.rb +2 -2
  71. data/lib/sisimai/order.rb +2 -27
  72. data/lib/sisimai/reason.rb +3 -5
  73. data/lib/sisimai/rfc1894.rb +1 -1
  74. data/lib/sisimai/rfc3464.rb +29 -29
  75. data/lib/sisimai/rfc3834.rb +7 -6
  76. data/lib/sisimai/rfc5322.rb +20 -31
  77. data/lib/sisimai/rhost/franceptt.rb +120 -24
  78. data/lib/sisimai/rhost/iua.rb +1 -1
  79. data/lib/sisimai/smtp/error.rb +7 -7
  80. data/lib/sisimai/version.rb +1 -1
  81. data/set-of-emails/maildir/bsd/email-einsundeins-03.eml +66 -0
  82. data/set-of-emails/maildir/bsd/email-exchange2007-05.eml +1469 -0
  83. data/set-of-emails/maildir/bsd/email-exchange2007-06.eml +764 -0
  84. data/set-of-emails/maildir/bsd/email-postfix-64.eml +96 -0
  85. data/set-of-emails/maildir/bsd/rfc3834-03.eml +26 -0
  86. data/set-of-emails/maildir/bsd/rhost-franceptt-04.eml +66 -0
  87. data/set-of-emails/maildir/bsd/rhost-franceptt-05.eml +96 -0
  88. data/set-of-emails/maildir/bsd/rhost-franceptt-06.eml +100 -0
  89. data/set-of-emails/maildir/bsd/rhost-franceptt-07.eml +97 -0
  90. data/set-of-emails/maildir/bsd/rhost-franceptt-08.eml +78 -0
  91. data/set-of-emails/maildir/bsd/rhost-franceptt-10.eml +79 -0
  92. data/set-of-emails/maildir/bsd/rhost-franceptt-11.eml +96 -0
  93. metadata +27 -21
  94. data/lib/sisimai/bite.rb +0 -42
  95. data/lib/sisimai/bite/email.rb +0 -18
  96. data/lib/sisimai/bite/json.rb +0 -16
  97. data/lib/sisimai/message/email.rb +0 -26
  98. data/lib/sisimai/message/json.rb +0 -24
  99. data/lib/sisimai/order/email.rb +0 -20
  100. data/lib/sisimai/order/json.rb +0 -16
@@ -7,10 +7,8 @@ module Sisimai::Lhost
7
7
  require 'sisimai/lhost'
8
8
 
9
9
  Indicators = Sisimai::Lhost.INDICATORS
10
- StartingOf = {
11
- message: ['Sorry, we were unable to deliver your message'],
12
- rfc822: ['--- Below this line is a copy of the message.'],
13
- }.freeze
10
+ ReBackbone = %r|^--- Below this line is a copy of the message[.]|.freeze
11
+ StartingOf = { message: ['Sorry, we were unable to deliver your message'] }.freeze
14
12
 
15
13
  def description; return 'Yahoo! MAIL: https://www.yahoo.com'; end
16
14
  def smtpagent; return Sisimai::Lhost.smtpagent(self); end
@@ -37,85 +35,64 @@ module Sisimai::Lhost
37
35
  return nil unless mhead['x-ymailisg']
38
36
 
39
37
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
40
- hasdivided = mbody.split("\n")
41
- rfc822list = [] # (Array) Each line in message/rfc822 part string
42
- blanklines = 0 # (Integer) The number of blank lines
38
+ emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
39
+ bodyslices = emailsteak[0].split("\n")
43
40
  readcursor = 0 # (Integer) Points the current cursor position
44
41
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
45
42
  v = nil
46
43
 
47
- while e = hasdivided.shift do
44
+ while e = bodyslices.shift do
45
+ # Read error messages and delivery status lines from the head of the email
46
+ # to the previous line of the beginning of the original message.
48
47
  if readcursor == 0
49
48
  # Beginning of the bounce message or delivery status part
50
- if e.start_with?(StartingOf[:message][0])
51
- readcursor |= Indicators[:deliverystatus]
52
- next
53
- end
49
+ readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
50
+ next
54
51
  end
52
+ next if (readcursor & Indicators[:deliverystatus]) == 0
53
+ next if e.empty?
55
54
 
56
- if (readcursor & Indicators[:'message-rfc822']) == 0
57
- # Beginning of the original message part
58
- if e == StartingOf[:rfc822][0]
59
- readcursor |= Indicators[:'message-rfc822']
60
- next
61
- end
62
- end
55
+ # Sorry, we were unable to deliver your message to the following address.
56
+ #
57
+ # <kijitora@example.org>:
58
+ # Remote host said: 550 5.1.1 <kijitora@example.org>... User Unknown [RCPT_TO]
59
+ v = dscontents[-1]
63
60
 
64
- if readcursor & Indicators[:'message-rfc822'] > 0
65
- # Inside of the original message part
66
- if e.empty?
67
- blanklines += 1
68
- break if blanklines > 1
69
- next
61
+ if cv = e.match(/\A[<](.+[@].+)[>]:[ \t]*\z/)
62
+ # <kijitora@example.org>:
63
+ if v['recipient']
64
+ # There are multiple recipient addresses in the message body.
65
+ dscontents << Sisimai::Lhost.DELIVERYSTATUS
66
+ v = dscontents[-1]
70
67
  end
71
- rfc822list << e
68
+ v['recipient'] = cv[1]
69
+ v['diagnosis'] = ''
70
+ recipients += 1
72
71
  else
73
- # Error message part
74
- next if (readcursor & Indicators[:deliverystatus]) == 0
75
- next if e.empty?
76
-
77
- # Sorry, we were unable to deliver your message to the following address.
78
- #
79
- # <kijitora@example.org>:
80
- # Remote host said: 550 5.1.1 <kijitora@example.org>... User Unknown [RCPT_TO]
81
- v = dscontents[-1]
72
+ if e.start_with?('Remote host said:')
73
+ # Remote host said: 550 5.1.1 <kijitora@example.org>... User Unknown [RCPT_TO]
74
+ v['diagnosis'] = e
82
75
 
83
- if cv = e.match(/\A[<](.+[@].+)[>]:[ \t]*\z/)
84
- # <kijitora@example.org>:
85
- if v['recipient']
86
- # There are multiple recipient addresses in the message body.
87
- dscontents << Sisimai::Lhost.DELIVERYSTATUS
88
- v = dscontents[-1]
89
- end
90
- v['recipient'] = cv[1]
91
- v['diagnosis'] = ''
92
- recipients += 1
76
+ # Get SMTP command from the value of "Remote host said:"
77
+ if cv = e.match(/\[([A-Z]{4}).*\]\z/) then v['command'] = cv[1] end
93
78
  else
94
- if e.start_with?('Remote host said:')
95
- # Remote host said: 550 5.1.1 <kijitora@example.org>... User Unknown [RCPT_TO]
96
- v['diagnosis'] = e
97
-
98
- # Get SMTP command from the value of "Remote host said:"
99
- if cv = e.match(/\[([A-Z]{4}).*\]\z/) then v['command'] = cv[1] end
100
- else
101
- # <mailboxfull@example.jp>:
79
+ # <mailboxfull@example.jp>:
80
+ # Remote host said:
81
+ # 550 5.2.2 <mailboxfull@example.jp>... Mailbox Full
82
+ # [RCPT_TO]
83
+ if v['diagnosis'].start_with?('Remote host said:')
102
84
  # Remote host said:
103
85
  # 550 5.2.2 <mailboxfull@example.jp>... Mailbox Full
104
- # [RCPT_TO]
105
- if v['diagnosis'].start_with?('Remote host said:')
106
- # Remote host said:
107
- # 550 5.2.2 <mailboxfull@example.jp>... Mailbox Full
108
- if cv = e.match(/\[([A-Z]{4}).*\]\z/)
109
- # [RCPT_TO]
110
- v['command'] = cv[1]
111
- else
112
- # 550 5.2.2 <mailboxfull@example.jp>... Mailbox Full
113
- v['diagnosis'] = e
114
- end
86
+ if cv = e.match(/\[([A-Z]{4}).*\]\z/)
87
+ # [RCPT_TO]
88
+ v['command'] = cv[1]
115
89
  else
116
- # Error message which does not start with 'Remote host said:'
117
- v['diagnosis'] << ' ' << e
90
+ # 550 5.2.2 <mailboxfull@example.jp>... Mailbox Full
91
+ v['diagnosis'] = e
118
92
  end
93
+ else
94
+ # Error message which does not start with 'Remote host said:'
95
+ v['diagnosis'] << ' ' << e
119
96
  end
120
97
  end
121
98
  end
@@ -128,8 +105,7 @@ module Sisimai::Lhost
128
105
  e['command'] ||= 'RCPT' if e['diagnosis'] =~ /[<].+[@].+[>]/
129
106
  end
130
107
 
131
- rfc822part = Sisimai::RFC5322.weedout(rfc822list)
132
- return { 'ds' => dscontents, 'rfc822' => rfc822part }
108
+ return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
133
109
  end
134
110
 
135
111
  end
@@ -7,10 +7,8 @@ module Sisimai::Lhost
7
7
  require 'sisimai/lhost'
8
8
 
9
9
  Indicators = Sisimai::Lhost.INDICATORS
10
- StartingOf = {
11
- message: ['This is the mail system at host yandex.ru.'],
12
- rfc822: ['Content-Type: message/rfc822'],
13
- }.freeze
10
+ ReBackbone = %r|^Content-Type:[ ]message/rfc822|.freeze
11
+ StartingOf = { message: ['This is the mail system at host yandex.ru.'] }.freeze
14
12
 
15
13
  def description; return 'Yandex.Mail: https://www.yandex.ru'; end
16
14
  def smtpagent; return Sisimai::Lhost.smtpagent(self); end
@@ -44,100 +42,77 @@ module Sisimai::Lhost
44
42
  permessage = {} # (Hash) Store values of each Per-Message field
45
43
 
46
44
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
47
- hasdivided = mbody.split("\n")
48
- havepassed = ['']
49
- rfc822list = [] # (Array) Each line in message/rfc822 part string
50
- blanklines = 0 # (Integer) The number of blank lines
45
+ emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
46
+ bodyslices = emailsteak[0].split("\n")
47
+ readslices = ['']
51
48
  readcursor = 0 # (Integer) Points the current cursor position
52
49
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
53
50
  commandset = [] # (Array) ``in reply to * command'' list
54
51
  v = nil
55
52
 
56
- while e = hasdivided.shift do
57
- # Save the current line for the next loop
58
- havepassed << e
59
- p = havepassed[-2]
53
+ while e = bodyslices.shift do
54
+ # Read error messages and delivery status lines from the head of the email
55
+ # to the previous line of the beginning of the original message.
56
+ readslices << e # Save the current line for the next loop
60
57
 
61
58
  if readcursor == 0
62
59
  # Beginning of the bounce message or message/delivery-status part
63
- if e.start_with?(StartingOf[:message][0])
64
- readcursor |= Indicators[:deliverystatus]
65
- next
66
- end
60
+ readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
61
+ next
67
62
  end
68
-
69
- if (readcursor & Indicators[:'message-rfc822']) == 0
70
- # Beginning of the original message part(message/rfc822)
71
- if e.start_with?(StartingOf[:rfc822][0])
72
- readcursor |= Indicators[:'message-rfc822']
73
- next
74
- end
75
- end
76
-
77
- if readcursor & Indicators[:'message-rfc822'] > 0
78
- # message/rfc822 OR text/rfc822-headers part
79
- if e.empty?
80
- blanklines += 1
81
- break if blanklines > 1
82
- next
83
- end
84
- rfc822list << e
85
- else
86
- # message/delivery-status part
87
- next if (readcursor & Indicators[:deliverystatus]) == 0
88
- next if e.empty?
89
-
90
- if f = Sisimai::RFC1894.match(e)
91
- # "e" matched with any field defined in RFC3464
92
- next unless o = Sisimai::RFC1894.field(e)
93
- v = dscontents[-1]
94
-
95
- if o[-1] == 'addr'
63
+ next if (readcursor & Indicators[:deliverystatus]) == 0
64
+ next if e.empty?
65
+
66
+ if f = Sisimai::RFC1894.match(e)
67
+ # "e" matched with any field defined in RFC3464
68
+ next unless o = Sisimai::RFC1894.field(e)
69
+ v = dscontents[-1]
70
+
71
+ if o[-1] == 'addr'
72
+ # Final-Recipient: rfc822; kijitora@example.jp
73
+ # X-Actual-Recipient: rfc822; kijitora@example.co.jp
74
+ if o[0] == 'final-recipient'
96
75
  # Final-Recipient: rfc822; kijitora@example.jp
97
- # X-Actual-Recipient: rfc822; kijitora@example.co.jp
98
- if o[0] == 'final-recipient'
99
- # Final-Recipient: rfc822; kijitora@example.jp
100
- if v['recipient']
101
- # There are multiple recipient addresses in the message body.
102
- dscontents << Sisimai::Lhost.DELIVERYSTATUS
103
- v = dscontents[-1]
104
- end
105
- v['recipient'] = o[2]
106
- recipients += 1
107
- else
108
- # X-Actual-Recipient: rfc822; kijitora@example.co.jp
109
- v['alias'] = o[2]
76
+ if v['recipient']
77
+ # There are multiple recipient addresses in the message body.
78
+ dscontents << Sisimai::Lhost.DELIVERYSTATUS
79
+ v = dscontents[-1]
110
80
  end
111
- elsif o[-1] == 'code'
112
- # Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
113
- v['spec'] = o[1]
114
- v['diagnosis'] = o[2]
81
+ v['recipient'] = o[2]
82
+ recipients += 1
115
83
  else
116
- # Other DSN fields defined in RFC3464
117
- next unless fieldtable.key?(o[0])
118
- v[fieldtable[o[0]]] = o[2]
119
-
120
- next unless f == 1
121
- permessage[fieldtable[o[0]]] = o[2]
84
+ # X-Actual-Recipient: rfc822; kijitora@example.co.jp
85
+ v['alias'] = o[2]
122
86
  end
87
+ elsif o[-1] == 'code'
88
+ # Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
89
+ v['spec'] = o[1]
90
+ v['diagnosis'] = o[2]
123
91
  else
124
- # The line does not begin with a DSN field defined in RFC3464
125
- if cv = e.match(/[ \t][(]in reply to .*([A-Z]{4}).*/)
126
- # 5.1.1 <userunknown@example.co.jp>... User Unknown (in reply to RCPT TO
127
- commandset << cv[1]
128
-
129
- elsif cv = e.match(/([A-Z]{4})[ \t]*.*command[)]\z/)
130
- # to MAIL command)
131
- commandset << cv[1]
132
- else
133
- # Continued line of the value of Diagnostic-Code field
134
- next unless p.start_with?('Diagnostic-Code:')
135
- next unless cv = e.match(/\A[ \t]+(.+)\z/)
136
- v['diagnosis'] << ' ' << cv[1]
137
- havepassed[-1] = 'Diagnostic-Code: ' << e
138
- end
92
+ # Other DSN fields defined in RFC3464
93
+ next unless fieldtable[o[0]]
94
+ v[fieldtable[o[0]]] = o[2]
95
+
96
+ next unless f == 1
97
+ permessage[fieldtable[o[0]]] = o[2]
139
98
  end
140
- end # End of message/delivery-status
99
+ else
100
+ # The line does not begin with a DSN field defined in RFC3464
101
+ if cv = e.match(/[ \t][(]in reply to .*([A-Z]{4}).*/)
102
+ # 5.1.1 <userunknown@example.co.jp>... User Unknown (in reply to RCPT TO
103
+ commandset << cv[1]
104
+
105
+ elsif cv = e.match(/([A-Z]{4})[ \t]*.*command[)]\z/)
106
+ # to MAIL command)
107
+ commandset << cv[1]
108
+ else
109
+ # Continued line of the value of Diagnostic-Code field
110
+ next unless readslices[-2].start_with?('Diagnostic-Code:')
111
+ next unless cv = e.match(/\A[ \t]+(.+)\z/)
112
+ v['diagnosis'] << ' ' << cv[1]
113
+ readslices[-1] = 'Diagnostic-Code: ' << e
114
+ end
115
+ end
141
116
  end
142
117
  return nil unless recipients > 0
143
118
 
@@ -151,8 +126,7 @@ module Sisimai::Lhost
151
126
  e['agent'] = self.smtpagent
152
127
  end
153
128
 
154
- rfc822part = Sisimai::RFC5322.weedout(rfc822list)
155
- return { 'ds' => dscontents, 'rfc822' => rfc822part }
129
+ return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
156
130
  end
157
131
 
158
132
  end
@@ -7,10 +7,8 @@ module Sisimai::Lhost
7
7
  require 'sisimai/lhost'
8
8
 
9
9
  Indicators = Sisimai::Lhost.INDICATORS
10
- StartingOf = {
11
- message: ['This message was created automatically by mail delivery'],
12
- rfc822: ['from mail.zoho.com by mx.zohomail.com'],
13
- }.freeze
10
+ ReBackbone = %r|^Received:[ ]*from[ ]mail[.]zoho[.]com[ ]by[ ]mx[.]zohomail[.]com|.freeze
11
+ StartingOf = { message: ['This message was created automatically by mail delivery'] }.freeze
14
12
  MessagesOf = { 'expired' => ['Host not reachable'] }.freeze
15
13
 
16
14
  def description; return 'Zoho Mail: https://www.zoho.com'; end
@@ -43,90 +41,69 @@ module Sisimai::Lhost
43
41
  return nil unless mhead['x-zohomail']
44
42
 
45
43
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
46
- hasdivided = mbody.split("\n")
47
- rfc822list = [] # (Array) Each line in message/rfc822 part string
48
- blanklines = 0 # (Integer) The number of blank lines
44
+ emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
45
+ bodyslices = emailsteak[0].split("\n")
49
46
  readcursor = 0 # (Integer) Points the current cursor position
50
47
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
51
48
  qprintable = false
52
49
  v = nil
53
50
 
54
- while e = hasdivided.shift do
51
+ while e = bodyslices.shift do
52
+ # Read error messages and delivery status lines from the head of the email
53
+ # to the previous line of the beginning of the original message.
55
54
  if readcursor == 0
56
55
  # Beginning of the bounce message or delivery status part
57
- if e.start_with?(StartingOf[:message][0])
58
- readcursor |= Indicators[:deliverystatus]
59
- next
60
- end
56
+ readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
57
+ next
61
58
  end
62
-
63
- if (readcursor & Indicators[:'message-rfc822']) == 0
64
- # Beginning of the original message part
65
- if e.include?(StartingOf[:rfc822][0])
66
- readcursor |= Indicators[:'message-rfc822']
67
- next
59
+ next if (readcursor & Indicators[:deliverystatus]) == 0
60
+ next if e.empty?
61
+
62
+ # This message was created automatically by mail delivery software.
63
+ # A message that you sent could not be delivered to one or more of its recip=
64
+ # ients. This is a permanent error.=20
65
+ #
66
+ # kijitora@example.co.jp Invalid Address, ERROR_CODE :550, ERROR_CODE :5.1.=
67
+ # 1 <kijitora@example.co.jp>... User Unknown
68
+
69
+ # This message was created automatically by mail delivery software.
70
+ # A message that you sent could not be delivered to one or more of its recipients. This is a permanent error.
71
+ #
72
+ # shironeko@example.org Invalid Address, ERROR_CODE :550, ERROR_CODE :Requested action not taken: mailbox unavailable
73
+ v = dscontents[-1]
74
+
75
+ if cv = e.match(/\A([^ ]+[@][^ ]+)[ \t]+(.+)\z/)
76
+ # kijitora@example.co.jp Invalid Address, ERROR_CODE :550, ERROR_CODE :5.1.=
77
+ if v['recipient']
78
+ # There are multiple recipient addresses in the message body.
79
+ dscontents << Sisimai::Lhost.DELIVERYSTATUS
80
+ v = dscontents[-1]
68
81
  end
69
- end
82
+ v['recipient'] = cv[1]
83
+ v['diagnosis'] = cv[2]
70
84
 
71
- if readcursor & Indicators[:'message-rfc822'] > 0
72
- # Inside of the original message part
73
- if e.empty?
74
- blanklines += 1
75
- break if blanklines > 1
76
- next
85
+ if v['diagnosis'].end_with?('=')
86
+ # Quoted printable
87
+ v['diagnosis'] = v['diagnosis'].chomp('=')
88
+ qprintable = true
77
89
  end
78
- rfc822list << e
79
- else
80
- # Error message part
81
- next if (readcursor & Indicators[:deliverystatus]) == 0
82
- next if e.empty?
83
-
84
- # This message was created automatically by mail delivery software.
85
- # A message that you sent could not be delivered to one or more of its recip=
86
- # ients. This is a permanent error.=20
87
- #
88
- # kijitora@example.co.jp Invalid Address, ERROR_CODE :550, ERROR_CODE :5.1.=
89
- # 1 <kijitora@example.co.jp>... User Unknown
90
-
91
- # This message was created automatically by mail delivery software.
92
- # A message that you sent could not be delivered to one or more of its recipients. This is a permanent error.
93
- #
94
- # shironeko@example.org Invalid Address, ERROR_CODE :550, ERROR_CODE :Requested action not taken: mailbox unavailable
95
- v = dscontents[-1]
96
-
97
- if cv = e.match(/\A([^ ]+[@][^ ]+)[ \t]+(.+)\z/)
98
- # kijitora@example.co.jp Invalid Address, ERROR_CODE :550, ERROR_CODE :5.1.=
99
- if v['recipient']
100
- # There are multiple recipient addresses in the message body.
101
- dscontents << Sisimai::Lhost.DELIVERYSTATUS
102
- v = dscontents[-1]
103
- end
104
- v['recipient'] = cv[1]
105
- v['diagnosis'] = cv[2]
106
-
107
- if v['diagnosis'].end_with?('=')
108
- # Quoted printable
109
- v['diagnosis'] = v['diagnosis'].chomp('=')
110
- qprintable = true
111
- end
112
- recipients += 1
113
-
114
- elsif cv = e.match(/\A\[Status: .+[<]([^ ]+[@][^ ]+)[>],/)
115
- # Expired
116
- # [Status: Error, Address: <kijitora@6kaku.example.co.jp>, ResponseCode 421, , Host not reachable.]
117
- if v['recipient']
118
- # There are multiple recipient addresses in the message body.
119
- dscontents << Sisimai::Lhost.DELIVERYSTATUS
120
- v = dscontents[-1]
121
- end
122
- v['recipient'] = cv[1]
123
- v['diagnosis'] = e
124
- recipients += 1
125
- else
126
- # Continued line
127
- next unless qprintable
128
- v['diagnosis'] << e
90
+ recipients += 1
91
+
92
+ elsif cv = e.match(/\A\[Status: .+[<]([^ ]+[@][^ ]+)[>],/)
93
+ # Expired
94
+ # [Status: Error, Address: <kijitora@6kaku.example.co.jp>, ResponseCode 421, , Host not reachable.]
95
+ if v['recipient']
96
+ # There are multiple recipient addresses in the message body.
97
+ dscontents << Sisimai::Lhost.DELIVERYSTATUS
98
+ v = dscontents[-1]
129
99
  end
100
+ v['recipient'] = cv[1]
101
+ v['diagnosis'] = e
102
+ recipients += 1
103
+ else
104
+ # Continued line
105
+ next unless qprintable
106
+ v['diagnosis'] << e
130
107
  end
131
108
  end
132
109
  return nil unless recipients > 0
@@ -143,8 +120,7 @@ module Sisimai::Lhost
143
120
  end
144
121
  end
145
122
 
146
- rfc822part = Sisimai::RFC5322.weedout(rfc822list)
147
- return { 'ds' => dscontents, 'rfc822' => rfc822part }
123
+ return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
148
124
  end
149
125
 
150
126
  end