sisimai 4.23.0-java → 4.24.0-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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/ANALYTICAL-PRECISION +31 -21
  3. data/ChangeLog.md +20 -1
  4. data/README-JA.md +4 -4
  5. data/README.md +4 -4
  6. data/lib/sisimai/address.rb +1 -3
  7. data/lib/sisimai/bite/email/activehunter.rb +1 -0
  8. data/lib/sisimai/bite/email/amazonses.rb +2 -4
  9. data/lib/sisimai/bite/email/amazonworkmail.rb +5 -9
  10. data/lib/sisimai/bite/email/apachejames.rb +8 -4
  11. data/lib/sisimai/bite/email/exim.rb +3 -7
  12. data/lib/sisimai/bite/email/google.rb +1 -3
  13. data/lib/sisimai/bite/email/gsuite.rb +1 -0
  14. data/lib/sisimai/bite/email/interscanmss.rb +1 -1
  15. data/lib/sisimai/bite/email/mailru.rb +3 -7
  16. data/lib/sisimai/bite/email/mxlogic.rb +3 -7
  17. data/lib/sisimai/bite/email/qmail.rb +3 -6
  18. data/lib/sisimai/bite/email/x4.rb +3 -6
  19. data/lib/sisimai/bite/email/yahoo.rb +2 -4
  20. data/lib/sisimai/bite/json/amazonses.rb +2 -4
  21. data/lib/sisimai/data.rb +13 -23
  22. data/lib/sisimai/message/email.rb +24 -39
  23. data/lib/sisimai/mime.rb +214 -38
  24. data/lib/sisimai/reason.rb +1 -3
  25. data/lib/sisimai/reason/blocked.rb +2 -0
  26. data/lib/sisimai/rfc3464.rb +8 -12
  27. data/lib/sisimai/rfc5322.rb +1 -3
  28. data/lib/sisimai/string.rb +8 -6
  29. data/lib/sisimai/version.rb +1 -1
  30. data/set-of-emails/maildir/bsd/email-apachejames-01.eml +1 -2
  31. data/set-of-emails/maildir/bsd/{rfc3464-02.eml → email-domino-03.eml} +0 -0
  32. data/set-of-emails/maildir/bsd/email-office365-08.eml +49 -51
  33. data/set-of-emails/maildir/bsd/email-outlook-08.eml +3 -2
  34. data/set-of-emails/maildir/bsd/email-sendmail-56.eml +86 -0
  35. data/set-of-emails/maildir/bsd/email-verizon-02.eml +1 -2
  36. metadata +4 -4
  37. data/lib/sisimai/rfc2606.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73de606d2527add28e57a63f3effee176c9e3335
4
- data.tar.gz: 15638952f75eed10312c5fdc86eb0b9bafe51036
3
+ metadata.gz: e61dc629c7835e590273d8831e33c6f6dfb8ed63
4
+ data.tar.gz: 5c71c68bb90a88369230641f3d4c4b36855ed75c
5
5
  SHA512:
6
- metadata.gz: 884c09b660e055f66fea8a4ed054a88166435e07ab53794634add39300bf3a574a13e16367d3681968815c95c75fb56a9477a3f28fecf77074bd935123a223f7
7
- data.tar.gz: 31f8b5db508737038e8c87f14a7cf3e382c284399875f435e343f6472692b3fd6190ad39dc65cc394d012aa18cf60a95a743f93278c561c59df4170b79e52657
6
+ metadata.gz: e1f02b5c386ea95988ee5170c811729fae627eb939a563638ca199bc0b7eae477e7af9473f6baef234fd83cd3043c7cece28e9b6d1f08508432f7c7b07e5c040
7
+ data.tar.gz: 3b91d1f4ca51663adb379dd30290b9358ecf32f24ff32e610274fa59894f8ec31fc6271cde142476293d9f5181b00eb1436ac4da30dcd7adc915cf88ea5922b7
data/ANALYTICAL-PRECISION CHANGED
@@ -1,24 +1,35 @@
1
+ for v in `ls -1 ./lib/Sisimai/Bite/Email/*.pm | grep -v UserDefined`; do \
2
+ MTA=`echo $v | cut -d/ -f6 | tr '[A-Z]' '[a-z]' | sed 's/.pm//g'` ;\
3
+ mkdir -p tmp/emails-for-precision/email-$MTA ;\
4
+ cp set-of-emails/maildir/bsd/email-$MTA-*.eml tmp/emails-for-precision/email-$MTA/ ;\
5
+ cp set-of-emails/private/email-$MTA/* tmp/emails-for-precision/email-$MTA/ ;\
6
+ done
7
+ for v in arf rfc3464 rfc3834; do \
8
+ mkdir -p tmp/emails-for-precision/$v ;\
9
+ cp set-of-emails/maildir/bsd/$v*.eml tmp/emails-for-precision/$v/ ;\
10
+ cp set-of-emails/private/$v/* tmp/emails-for-precision/$v/ ;\
11
+ done
1
12
  bounceHammer 2.7.13p3
2
13
  MTA MODULE NAME CAN PARSE RATIO NOTES
3
14
  --------------------------------------------------------------------------------
4
15
  Email::Activehunter ..... 0/0014 0.0000 TransWARE Active!hunter
5
- Email::AmazonSES ........ 31/0040 0.7750 Amazon SES(Sending): http://aws.amazon.com/ses/
16
+ Email::AmazonSES ........ 40/0049 0.8163 Amazon SES(Sending): http://aws.amazon.com/ses/
6
17
  Email::AmazonWorkMail ... 9/0013 0.6923 Amazon WorkMail: https://aws.amazon.com/workmail/
7
18
  Email::Aol .............. 20/0023 0.8696 Aol Mail: http://www.aol.com
8
19
  Email::ApacheJames ...... 0/0006 0.0000 Java Apache Mail Enterprise Server
9
20
  Email::Bigfoot .......... 3/0003 1.0000 Bigfoot: http://www.bigfoot.com
10
21
  Email::Biglobe .......... 5/0007 0.7143 BIGLOBE: http://www.biglobe.ne.jp
11
22
  Email::Courier .......... 14/0016 0.8750 Courier MTA
12
- Email::Domino ........... 6/0016 0.3750 IBM Domino Server
23
+ Email::Domino ........... 9/0018 0.5000 IBM Domino Server
13
24
  Email::EZweb ............ 131/0124 1.0000 au EZweb: http://www.au.kddi.com/mobile/
14
25
  Email::EinsUndEins ...... 0/0004 0.0000 1&1: http://www.1and1.de
15
26
  Email::Exchange2003 ..... 1/0051 0.0196 Microsoft Exchange Server 2003
16
- Email::Exchange2007 ..... 6/0008 0.7500 Microsoft Exchange Server 2007
17
- Email::Exim ............. 226/0282 0.8014 Exim
27
+ Email::Exchange2007 ..... 8/0010 0.8000 Microsoft Exchange Server 2007
28
+ Email::Exim ............. 228/0253 0.9012 Exim
18
29
  Email::FML .............. 0/0004 0.0000 fml mailing list server/manager
19
30
  Email::Facebook ......... 5/0005 1.0000 Facebook: https://www.facebook.com
20
31
  Email::GMX .............. 0/0010 0.0000 GMX: http://www.gmx.net
21
- Email::GSuite ........... 18/0018 1.0000 G Suite: https://gsuite.google.com/
32
+ Email::GSuite ........... 19/0019 1.0000 G Suite: https://gsuite.google.com/
22
33
  Email::Google ........... 59/0061 0.9672 Google Gmail: https://mail.google.com
23
34
  Email::IMailServer ...... 0/0022 0.0000 IPSWITCH IMail Server
24
35
  Email::InterScanMSS ..... 0/0008 0.0000 Trend Micro InterScan Messaging Security Suite
@@ -26,36 +37,35 @@ Email::KDDI ............. 6/0006 1.0000 au by KDDI: http://www.au.kddi.com
26
37
  Email::MXLogic .......... 0/0014 0.0000 McAfee SaaS
27
38
  Email::MailFoundry ...... 0/0007 0.0000 MailFoundry
28
39
  Email::MailMarshalSMTP .. 0/0004 0.0000 Trustwave Secure Email Gateway
29
- Email::MailRu ........... 4/0022 0.1818 @mail.ru: https://mail.ru
30
- Email::McAfee ........... 0/0011 0.0000 McAfee Email Appliance
31
- Email::MessageLabs ...... 5/0005 1.0000 Symantec.cloud http://www.messagelabs.com
40
+ Email::MailRu ........... 4/0023 0.1739 @mail.ru: https://mail.ru
41
+ Email::McAfee ........... 0/0012 0.0000 McAfee Email Appliance
42
+ Email::MessageLabs ...... 7/0007 1.0000 Symantec.cloud http://www.messagelabs.com
32
43
  Email::MessagingServer .. 28/0031 0.9032 Oracle Communications Messaging Server
33
44
  Email::Notes ............ 0/0013 0.0000 Lotus Notes
34
- Email::Office365 ........ 14/0017 0.8235 Microsoft Office 365: http://office.microsoft.com/
45
+ Email::Office365 ........ 22/0025 0.8800 Microsoft Office 365: http://office.microsoft.com/
35
46
  Email::OpenSMTPD ........ 6/0024 0.2500 OpenSMTPD
36
- Email::Outlook .......... 20/0022 0.9091 Microsoft Outlook.com: https://www.outlook.com/
37
- Email::Postfix .......... 211/0227 0.9295 Postfix
47
+ Email::Outlook .......... 21/0023 0.9130 Microsoft Outlook.com: https://www.outlook.com/
48
+ Email::Postfix .......... 222/0238 0.9328 Postfix
38
49
  Email::ReceivingSES ..... 0/0007 0.0000 Amazon SES(Receiving): http://aws.amazon.com/ses/
39
50
  Email::SendGrid ......... 7/0012 0.5833 SendGrid: http://sendgrid.com/
40
- Email::Sendmail ......... 346/0271 1.0000 V8Sendmail: /usr/sbin/sendmail
51
+ Email::Sendmail ......... 354/0280 1.0000 V8Sendmail: /usr/sbin/sendmail
41
52
  Email::SurfControl ...... 6/0008 0.7500 WebSense SurfControl
42
53
  Email::V5sendmail ....... 0/0386 0.0000 Sendmail version 5
43
54
  Email::Verizon .......... 4/0004 1.0000 Verizon Wireless: http://www.verizonwireless.com
44
55
  Email::X1 ............... 0/0007 0.0000 Unknown MTA #1
45
56
  Email::X2 ............... 0/0068 0.0000 Unknown MTA #2
46
57
  Email::X3 ............... 0/0012 0.0000 Unknown MTA #3
47
- Email::X4 ............... 0/0028 0.0000 Unknown MTA #4 qmail clones
58
+ Email::X4 ............... 0/0029 0.0000 Unknown MTA #4 qmail clones
48
59
  Email::X5 ............... 3/0003 1.0000 Unknown MTA #5
49
- Email::Yahoo ............ 0/0021 0.0000 Yahoo! MAIL: https://www.yahoo.com
60
+ Email::Yahoo ............ 0/0025 0.0000 Yahoo! MAIL: https://www.yahoo.com
50
61
  Email::Yandex ........... 4/0007 0.5714 Yandex.Mail: http://www.yandex.ru
51
62
  Email::Zoho ............. 0/0011 0.0000 Zoho Mail: https://www.zoho.com
52
63
  Email::mFILTER .......... 0/0009 0.0000 Digital Arts m-FILTER
53
- Email::qmail ............ 55/0084 0.6548 qmail
54
- JSON::AmazonSES ......... 31/0040 0.7750 Amazon SES(JSON): http://aws.amazon.com/ses/
64
+ Email::qmail ............ 56/0085 0.6588 qmail
65
+ JSON::AmazonSES ......... 40/0049 0.8163 Amazon SES(JSON): http://aws.amazon.com/ses/
55
66
  JSON::SendGrid .......... 7/0012 0.5833 SendGrid(JSON): http://sendgrid.com/
56
- ARF ..................... 8/0037 0.2162 Abuse Feedback Reporting Format
57
- RFC3464 ................. 148/0289 0.5121 Fallback Module for MTAs
58
- RFC3834 ................. 0/0012 0.0000 Detector for auto replied message
67
+ ARF ..................... 8/0037 0.2162 RFC3464 ................. 150/0292 0.5137 Fallback Module for MTAs
68
+ RFC3834 ................. 0/0013 0.0000 Detector for auto replied message
59
69
  --------------------------------------------------------------------------------
60
- bounceHammer 2.7.13p3 1447/2466 0.5868
61
- Sisimai v4.22.6 2466/2466 1.0000
70
+ bounceHammer 2.7.13p3 1356/2211 0.6133
71
+ Sisimai v4.24.0 2211/2211 1.0000
data/ChangeLog.md CHANGED
@@ -3,9 +3,26 @@ RELEASE NOTES for Ruby version of Sisimai
3
3
  - releases: "https://github.com/sisimai/rb-Sisimai/releases"
4
4
  - download: "https://rubygems.org/gems/sisimai"
5
5
 
6
+ v4.24.0
7
+ --------------------------------------------------------------------------------
8
+ - release: "Thu, 1 Nov 2018 18:00:00 +0900 (JST)"
9
+ - version: "4.24.0"
10
+ - changes:
11
+ - Variable improvement (remove redundant substitution)
12
+ - Remove Sisimai::RFC2606 (Unused module)
13
+ - MIME decoding improvement #130 Thanks to @outreach-soren.
14
+ - Implement Sisimai::MIME.makeflat
15
+ - Implement Sisimai::MIME.breaksup
16
+ - Call Sisimai::MIME.makeflat at Sisimai::Message::Email.parse
17
+ - Other related updates in Sisimai::Bite::Email::*
18
+ - Tiny improvement in Sisimai::String.to_plain
19
+ - Update "blocked" error message patterns for iCloud.
20
+ - A client IP address has no PTR record
21
+ - Invalid HELO/EHLO name
22
+
6
23
  v4.23.0
7
24
  --------------------------------------------------------------------------------
8
- - release: ""
25
+ - release: "Fri, 31 Aug 2018 20:19:54 +0900 (JST)"
9
26
  - version: "4.23.0"
10
27
  - changes:
11
28
  - #124 Implement Sisimai::Mail::Memory class for reading bounce messages from
@@ -17,6 +34,8 @@ v4.23.0
17
34
  - #128 Less method calls: use method chain, bang method.
18
35
  - Import commit sisimai/p5-Sisimai@cccb4ef Some test code have been loosened
19
36
  for UTC+13(Pacific/Tongatapu), UTC+14(Pacific/Kiritimati).
37
+ - #127 Fix "NoMethodError" in Sisimai::Bite::Email::Postfix when the value of
38
+ Diagnostic-Code field is folded. Thanks to @Unknown22.
20
39
 
21
40
  v4.22.7
22
41
  --------------------------------------------------------------------------------
data/README-JA.md CHANGED
@@ -241,16 +241,16 @@ Differences between Ruby version and Perl version
241
241
  | 動作環境 | Ruby 2.1 - 2.5 | Perl 5.10 - |
242
242
  | | JRuby 9.0.4.0- | |
243
243
  | 解析精度の割合(2000通のメール)[1] | 1.00 | 1.00 |
244
- | メール解析速度(1000通のメール) | 3.75秒[2] | 1.70秒 |
244
+ | メール解析速度(1000通のメール) | 3.20秒[2] | 1.60秒 |
245
245
  | インストール方法 | gem install | cpanm, cpm |
246
246
  | 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
247
- | LOC:ソースコードの行数 | 11700行 | 8500行 |
248
- | テスト件数(spec/,t/,xt/ディレクトリ) | 218000件 | 236000件 |
247
+ | LOC:ソースコードの行数 | 11700行 | 8600行 |
248
+ | テスト件数(spec/,t/,xt/ディレクトリ) | 218000件 | 236600件 |
249
249
  | ライセンス | 二条項BSD | 二条項BSD |
250
250
  | 開発会社によるサポート契約 | 準備中 | 提供中 |
251
251
 
252
252
  1. [./ANALYTICAL-PRECISION](https://github.com/sisimai/rb-Sisimai/blob/master/ANALYTICAL-PRECISION)を参照
253
- 2. Xeon E5-2640 2.5GHz x 2 cores | 5000 bogomips | 1GB RAM | Ruby 2.3.4
253
+ 2. Xeon E5-2640 2.5GHz x 2 cores | 5000 bogomips | 1GB RAM | Ruby 2.3.4p301
254
254
 
255
255
  Other spec of Sisimai
256
256
  -------------------------------------------------------------------------------
data/README.md CHANGED
@@ -245,16 +245,16 @@ and bounceHammer are available at
245
245
  | System requirements | Ruby 2.1 - 2.5 | Perl 5.10 - |
246
246
  | | JRuby 9.0.4.0- | |
247
247
  | Analytical precision ratio(2000 emails)[1] | 1.00 | 1.00 |
248
- | The speed of parsing email(1000 emails) | 3.75s[2] | 1.70s |
248
+ | The speed of parsing email(1000 emails) | 3.20s[2] | 1.60s |
249
249
  | How to install | gem install | cpanm, cpm |
250
250
  | Dependencies (Except core modules) | 1 module | 2 modules |
251
- | LOC:Source lines of code | 11700 lines | 8500 lines |
252
- | The number of tests(spec/,t/,xt/) directory | 218000 tests | 236000 tests |
251
+ | LOC:Source lines of code | 11700 lines | 8600 lines |
252
+ | The number of tests(spec/,t/,xt/) directory | 218000 tests | 236600 tests |
253
253
  | License | BSD 2-Clause | BSD 2-Clause |
254
254
  | Support Contract provided by Developer | Coming soon | Available |
255
255
 
256
256
  1. See [./ANALYTICAL-PRECISION](https://github.com/sisimai/rb-Sisimai/blob/master/ANALYTICAL-PRECISION)
257
- 2. Xeon E5-2640 2.5GHz x 2 cores | 5000 bogomips | 1GB RAM | Ruby 2.3.4
257
+ 2. Xeon E5-2640 2.5GHz x 2 cores | 5000 bogomips | 1GB RAM | Ruby 2.3.4p301
258
258
 
259
259
  Other specification of Sisimai
260
260
  -------------------------------------------------------------------------------
@@ -304,9 +304,7 @@ module Sisimai
304
304
 
305
305
  local = email.split('@')
306
306
  value = ''
307
- if cv = local[0].match(/\A([-_\w]+?)[+].+\z/)
308
- value = cv[1] + '@' + local[1]
309
- end
307
+ if cv = local[0].match(/\A([-_\w]+?)[+].+\z/) then value = cv[1] + '@' + local[1] end
310
308
  return value
311
309
  end
312
310
 
@@ -93,6 +93,7 @@ module Sisimai::Bite::Email
93
93
  # ----- Transcript of session follows -----
94
94
  # 550 sorry, no mailbox here by that name (#5.1.1 - chkusr)
95
95
  next unless e =~ /\A[0-9A-Za-z]+/
96
+ next unless v['diagnosis'].empty?
96
97
  v['diagnosis'] = e
97
98
  end
98
99
  end
@@ -195,10 +195,8 @@ module Sisimai::Bite::Email
195
195
  # Get other D.S.N. value from the error message
196
196
  errormessage = e['diagnosis']
197
197
 
198
- if cv = e['diagnosis'].match(/["'](\d[.]\d[.]\d.+)['"]/)
199
- # 5.1.0 - Unknown address error 550-'5.7.1 ...
200
- errormessage = cv[1]
201
- end
198
+ # 5.1.0 - Unknown address error 550-'5.7.1 ...
199
+ if cv = e['diagnosis'].match(/["'](\d[.]\d[.]\d.+)['"]/) then errormessage = cv[1] end
202
200
  pseudostatus = Sisimai::SMTP::Status.find(errormessage)
203
201
  e['status'] = pseudostatus unless pseudostatus.empty?
204
202
  end
@@ -151,20 +151,16 @@ module Sisimai::Bite::Email
151
151
  # Get other D.S.N. value from the error message
152
152
  errormessage = e['diagnosis']
153
153
 
154
- if cv = e['diagnosis'].match(/["'](\d[.]\d[.]\d.+)['"]/)
155
- # 5.1.0 - Unknown address error 550-'5.7.1 ...
156
- errormessage = cv[1]
157
- end
154
+ # 5.1.0 - Unknown address error 550-'5.7.1 ...
155
+ if cv = e['diagnosis'].match(/["'](\d[.]\d[.]\d.+)['"]/) then errormessage = cv[1] end
158
156
 
159
157
  pseudostatus = Sisimai::SMTP::Status.find(errormessage)
160
158
  e['status'] = pseudostatus unless pseudostatus.empty?
161
159
  end
162
160
 
163
- if cv = e['diagnosis'].match(/[<]([245]\d\d)[ ].+[>]/)
164
- # 554 4.4.7 Message expired: unable to deliver in 840 minutes.
165
- # <421 4.4.2 Connection timed out>
166
- e['replycode'] = cv[1]
167
- end
161
+ # 554 4.4.7 Message expired: unable to deliver in 840 minutes.
162
+ # <421 4.4.2 Connection timed out>
163
+ if cv = e['diagnosis'].match(/[<]([245]\d\d)[ ].+[>]/) then e['replycode'] = cv[1] end
168
164
 
169
165
  e['reason'] ||= Sisimai::SMTP::Status.name(e['status'])
170
166
  e['agent'] = self.smtpagent
@@ -11,7 +11,7 @@ module Sisimai::Bite::Email
11
11
  # apache-james-2.3.2/src/java/org/apache/james/transport/mailets/
12
12
  # AbstractNotify.java|124: out.println("Error message below:");
13
13
  # AbstractNotify.java|128: out.println("Message details:");
14
- message: ['Content-Disposition: inline'],
14
+ message: [''],
15
15
  rfc822: ['Content-Type: message/rfc822'],
16
16
  error: ['Error message below:'],
17
17
  }.freeze
@@ -46,7 +46,7 @@ module Sisimai::Bite::Email
46
46
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
47
47
  diagnostic = '' # (String) Alternative diagnostic message
48
48
  subjecttxt = nil # (String) Alternative Subject text
49
- gotmessage = -1 # (Integer) Flag for error message
49
+ gotmessage = nil # (Boolean) Flag for error message
50
50
  v = nil
51
51
 
52
52
  while e = hasdivided.shift do
@@ -108,14 +108,14 @@ module Sisimai::Bite::Email
108
108
  # Subject: Nyaaan
109
109
  subjecttxt = cv[1]
110
110
  else
111
- next if gotmessage == 1
111
+ next if gotmessage
112
112
  if v['diagnosis']
113
113
  # Get an error message text
114
114
  if e.start_with?('Message details:')
115
115
  # Message details:
116
116
  # Subject: nyaan
117
117
  # ...
118
- gotmessage = 1
118
+ gotmessage = true
119
119
  else
120
120
  # Append error message text like the followng:
121
121
  # Error message below:
@@ -126,6 +126,10 @@ module Sisimai::Bite::Email
126
126
  # Error message below:
127
127
  # 550 - Requested action not taken: no such user here
128
128
  v['diagnosis'] = e if e == StartingOf[:error][0]
129
+ unless gotmessage
130
+ v['diagnosis'] ||= ''
131
+ v['diagnosis'] << ' ' + e
132
+ end
129
133
  end
130
134
  end
131
135
  end
@@ -357,9 +357,7 @@ module Sisimai::Bite::Email
357
357
  unless mhead['received'].empty?
358
358
  # Get the name of local MTA
359
359
  # Received: from marutamachi.example.org (c192128.example.net [192.0.2.128])
360
- if cv = mhead['received'][-1].match(/from[ \t]([^ ]+)/)
361
- localhost0 = cv[1]
362
- end
360
+ if cv = mhead['received'][-1].match(/from[ \t]([^ ]+)/) then localhost0 = cv[1] end
363
361
  end
364
362
 
365
363
  dscontents.each do |e|
@@ -418,10 +416,8 @@ module Sisimai::Bite::Email
418
416
 
419
417
  unless e['rhost']
420
418
  # Get the remote host name
421
- if cv = e['diagnosis'].match(/host[ \t]+([^ \t]+)[ \t]\[.+\]:[ \t]/)
422
- # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
423
- e['rhost'] = cv[1]
424
- end
419
+ # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
420
+ if cv = e['diagnosis'].match(/host[ \t]+([^ \t]+)[ \t]\[.+\]:[ \t]/) then e['rhost'] = cv[1] end
425
421
 
426
422
  unless e['rhost']
427
423
  # Get localhost and remote host name from Received header.
@@ -266,9 +266,7 @@ module Sisimai::Bite::Email
266
266
  end
267
267
  end
268
268
 
269
- if cv = e['diagnosis'].match(/[(]state[ ](\d+)[)][.]/)
270
- statecode0 = cv[1]
271
- end
269
+ if cv = e['diagnosis'].match(/[(]state[ ](\d+)[)][.]/) then statecode0 = cv[1] end
272
270
  if StateTable[statecode0]
273
271
  # (state *)
274
272
  e['reason'] = StateTable[statecode0]['reason']
@@ -167,6 +167,7 @@ module Sisimai::Bite::Email
167
167
  if anotherset['diagnosis']
168
168
  # Continued error messages from the previous line like
169
169
  # "550 #5.1.0 Address rejected."
170
+ next if e =~ /\AContent-Type:/
170
171
  next if emptylines > 5
171
172
  if e.empty?
172
173
  # Count and next()
@@ -9,7 +9,7 @@ module Sisimai::Bite::Email
9
9
 
10
10
  Indicators = Sisimai::Bite::Email.INDICATORS
11
11
  StartingOf = {
12
- message: ['Content-type: text/plain'],
12
+ message: [''],
13
13
  rfc822: ['Content-type: message/rfc822'],
14
14
  }.freeze
15
15
 
@@ -182,9 +182,7 @@ module Sisimai::Bite::Email
182
182
  unless mhead['received'].empty?
183
183
  # Get the name of local MTA
184
184
  # Received: from marutamachi.example.org (c192128.example.net [192.0.2.128])
185
- if cv = mhead['received'][-1].match(/from[ \t]([^ ]+)/)
186
- localhost0 = cv[1]
187
- end
185
+ if cv = mhead['received'][-1].match(/from[ \t]([^ ]+)/) then localhost0 = cv[1] end
188
186
  end
189
187
 
190
188
  dscontents.each do |e|
@@ -205,10 +203,8 @@ module Sisimai::Bite::Email
205
203
 
206
204
  unless e['rhost']
207
205
  # Get the remote host name
208
- if cv = e['diagnosis'].match(/host[ ]+([^ \t]+)[ ]\[.+\]:[ ]/)
209
- # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
210
- e['rhost'] = cv[1]
211
- end
206
+ # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
207
+ if cv = e['diagnosis'].match(/host[ ]+([^ \t]+)[ ]\[.+\]:[ ]/) then e['rhost'] = cv[1] end
212
208
 
213
209
  unless e['rhost']
214
210
  # Get localhost and remote host name from Received header.
@@ -180,9 +180,7 @@ module Sisimai::Bite::Email
180
180
  unless mhead['received'].empty?
181
181
  # Get the name of local MTA
182
182
  # Received: from marutamachi.example.org (c192128.example.net [192.0.2.128])
183
- if cv = mhead['received'][-1].match(/from[ ]([^ ]+) /)
184
- localhost0 = cv[1]
185
- end
183
+ if cv = mhead['received'][-1].match(/from[ ]([^ ]+) /) then localhost0 = cv[1] end
186
184
  end
187
185
 
188
186
  dscontents.each do |e|
@@ -192,10 +190,8 @@ module Sisimai::Bite::Email
192
190
 
193
191
  unless e['rhost']
194
192
  # Get the remote host name
195
- if cv = e['diagnosis'].match(/host[ ]+([^ \t]+)[ ]\[.+\]:[ ]/)
196
- # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
197
- e['rhost'] = cv[1]
198
- end
193
+ # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
194
+ if cv = e['diagnosis'].match(/host[ ]+([^ \t]+)[ ]\[.+\]:[ ]/) then e['rhost'] = cv[1] end
199
195
 
200
196
  unless e['rhost']
201
197
  # Get localhost and remote host name from Received header.
@@ -187,9 +187,8 @@ module Sisimai::Bite::Email
187
187
  v['alterrors'] = e if e.start_with?(StartingOf[:error][0])
188
188
 
189
189
  next if v['rhost']
190
- if cv = e.match(ReHost)
191
- v['rhost'] = cv[1]
192
- end
190
+ next unless cv = e.match(ReHost)
191
+ v['rhost'] = cv[1]
193
192
  end
194
193
  end
195
194
  end
@@ -210,9 +209,7 @@ module Sisimai::Bite::Email
210
209
 
211
210
  unless e['command']
212
211
  # Verify each regular expression of patches
213
- if cv = e['diagnosis'].match(ReCommands)
214
- e['command'] = cv[1].upcase
215
- end
212
+ if cv = e['diagnosis'].match(ReCommands) then e['command'] = cv[1].upcase end
216
213
  e['command'] ||= ''
217
214
  end
218
215
  end
@@ -207,9 +207,8 @@ module Sisimai::Bite::Email
207
207
  v['alterrors'] = e if e.start_with?(StartingOf[:error][0])
208
208
 
209
209
  next if v['rhost']
210
- if cv = e.match(ReHost)
211
- v['rhost'] = cv[1]
212
- end
210
+ next unless cv = e.match(ReHost)
211
+ v['rhost'] = cv[1]
213
212
  end
214
213
  end
215
214
  end
@@ -230,9 +229,7 @@ module Sisimai::Bite::Email
230
229
 
231
230
  unless e['command']
232
231
  # Verify each regular expression of patches
233
- if cv = e['diagnosis'].match(ReCommands)
234
- e['command'] = cv[1].upcase
235
- end
232
+ if cv = e['diagnosis'].match(ReCommands) then e['command'] = cv[1].upcase end
236
233
  e['command'] ||= ''
237
234
  end
238
235
  end