sisimai 4.17.2-java → 4.18.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.
- checksums.yaml +4 -4
- data/ANALYTICAL-PRECISION +12 -11
- data/Changes +6 -0
- data/README-JA.md +5 -4
- data/README.md +5 -4
- data/Repository.mk +4 -1
- data/lib/sisimai/data.rb +44 -29
- data/lib/sisimai/msp/ru/mailru.rb +1 -5
- data/lib/sisimai/msp/us/amazonses.rb +0 -1
- data/lib/sisimai/msp/us/facebook.rb +0 -2
- data/lib/sisimai/msp/us/google.rb +0 -5
- data/lib/sisimai/msp/us/sendgrid.rb +4 -11
- data/lib/sisimai/mta.rb +4 -3
- data/lib/sisimai/mta/courier.rb +0 -2
- data/lib/sisimai/mta/{exchange.rb → exchange2003.rb} +9 -8
- data/lib/sisimai/mta/exchange2007.rb +172 -0
- data/lib/sisimai/mta/exim.rb +3 -23
- data/lib/sisimai/mta/mailfoundry.rb +3 -9
- data/lib/sisimai/mta/mxlogic.rb +1 -5
- data/lib/sisimai/mta/x4.rb +1 -5
- data/lib/sisimai/order.rb +4 -2
- data/lib/sisimai/smtp.rb +1 -0
- data/lib/sisimai/smtp/error.rb +149 -0
- data/lib/sisimai/smtp/reply.rb +14 -0
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/README.md +8 -2
- data/set-of-emails/maildir/bsd/{exchange-01.eml → exchange2003-01.eml} +0 -0
- data/set-of-emails/maildir/bsd/{exchange-02.eml → exchange2003-02.eml} +0 -0
- data/set-of-emails/maildir/bsd/{exchange-03.eml → exchange2003-03.eml} +0 -0
- data/set-of-emails/maildir/bsd/{exchange-04.eml → exchange2003-04.eml} +0 -0
- data/set-of-emails/maildir/bsd/{exchange-05.eml → exchange2003-05.eml} +0 -0
- data/set-of-emails/maildir/bsd/{exchange-06.eml → exchange2003-06.eml} +0 -0
- data/set-of-emails/maildir/bsd/exchange2007-01.eml +151 -0
- data/set-of-emails/maildir/bsd/exchange2007-02.eml +252 -0
- data/set-of-emails/maildir/bsd/rfc3464-28.eml +0 -0
- metadata +13 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1da191c307034c3f05ae22303f1b72d7ab9ee4b3
|
4
|
+
data.tar.gz: 14dd4e883a4d0ee9c827f9f86222f416fe185fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 566b746d973714fe370d3041db219bb1005599609ef17eb0f80bf0facd3aa5343bd524205dff013fcbced19effe5ac596bd6a8926f9f7334d1f77213b802651f
|
7
|
+
data.tar.gz: e270d541f5849a8beef3c12d09413b23d5b7fe24d6e699fa4b0ae0687b975747189ae836e38389687672c7f2a974d85637f19d1c2ed59a447d024cb5d0c2c9dc
|
data/ANALYTICAL-PRECISION
CHANGED
@@ -5,8 +5,9 @@ MTA::Activehunter ....... 0/0014 0.0000 TransWARE Active!hunter
|
|
5
5
|
MTA::ApacheJames ........ 0/0006 0.0000 Java Apache Mail Enterprise Server
|
6
6
|
MTA::Courier ............ 14/0016 0.8750 Courier MTA
|
7
7
|
MTA::Domino ............. 7/0015 0.4667 IBM Domino Server
|
8
|
-
MTA::
|
9
|
-
MTA::
|
8
|
+
MTA::Exchange2003 ....... 1/0051 0.0196 Microsoft Exchange Server 2003
|
9
|
+
MTA::Exchange2007 ....... 3/0004 0.7500 Microsoft Exchange Server 2007
|
10
|
+
MTA::Exim ............... 142/0172 0.8256 Exim
|
10
11
|
MTA::IMailServer ........ 0/0045 0.0000 IPSWITCH IMail Server
|
11
12
|
MTA::InterScanMSS ....... 0/0009 0.0000 Trend Micro InterScan Messaging Security Suite
|
12
13
|
MTA::MXLogic ............ 0/0014 0.0000 McAfee SaaS
|
@@ -16,8 +17,8 @@ MTA::McAfee ............. 0/0010 0.0000 McAfee Email Appliance
|
|
16
17
|
MTA::MessagingServer .... 19/0022 0.8636 Oracle Communications Messaging Server
|
17
18
|
MTA::Notes .............. 0/0012 0.0000 Lotus Notes
|
18
19
|
MTA::OpenSMTPD .......... 5/0023 0.2174 OpenSMTPD
|
19
|
-
MTA::Postfix ............
|
20
|
-
MTA::Sendmail ...........
|
20
|
+
MTA::Postfix ............ 165/0183 0.9016 Postfix
|
21
|
+
MTA::Sendmail ........... 259/0247 1.0000 V8Sendmail: /usr/sbin/sendmail
|
21
22
|
MTA::SurfControl ........ 6/0008 0.7500 WebSense SurfControl
|
22
23
|
MTA::V5sendmail ......... 0/0386 0.0000 Sendmail version 5
|
23
24
|
MTA::X1 ................. 0/0007 0.0000 Unknown MTA #1
|
@@ -29,7 +30,7 @@ MTA::mFILTER ............ 0/0009 0.0000 Digital Arts m-FILTER
|
|
29
30
|
MTA::qmail .............. 52/0078 0.6667 qmail
|
30
31
|
MSP::DE::EinsUndEins .... 0/0003 0.0000 1&1: http://www.1and1.de
|
31
32
|
MSP::DE::GMX ............ 0/0010 0.0000 GMX: http://www.gmx.net
|
32
|
-
MSP::JP::Biglobe ........
|
33
|
+
MSP::JP::Biglobe ........ 5/0007 0.7143 BIGLOBE: http://www.biglobe.ne.jp
|
33
34
|
MSP::JP::EZweb .......... 130/0125 1.0000 au EZweb: http://www.au.kddi.com/mobile/
|
34
35
|
MSP::JP::KDDI ........... 6/0006 1.0000 au by KDDI: http://www.au.kddi.com
|
35
36
|
MSP::RU::MailRu ......... 4/0014 0.2857 @mail.ru: https://mail.ru
|
@@ -40,17 +41,17 @@ MSP::US::AmazonWorkMail . 8/0012 0.6667 Amazon WorkMail: https://aws.amazon
|
|
40
41
|
MSP::US::Aol ............ 18/0021 0.8571 Aol Mail: http://www.aol.com
|
41
42
|
MSP::US::Bigfoot ........ 2/0002 1.0000 Bigfoot: http://www.bigfoot.com
|
42
43
|
MSP::US::Facebook ....... 3/0003 1.0000 Facebook: https://www.facebook.com
|
43
|
-
MSP::US::Google .........
|
44
|
-
MSP::US::Office365 ......
|
44
|
+
MSP::US::Google ......... 58/0062 0.9355 Google Gmail: https://mail.google.com
|
45
|
+
MSP::US::Office365 ...... 7/0010 0.7000 Microsoft Office 365: http://office.microsoft.com/
|
45
46
|
MSP::US::Outlook ........ 19/0021 0.9048 Microsoft Outlook.com: https://www.outlook.com/
|
46
47
|
MSP::US::ReceivingSES ... 0/0007 0.0000 Amazon SES(Receiving): http://aws.amazon.com/ses/
|
47
|
-
MSP::US::SendGrid .......
|
48
|
+
MSP::US::SendGrid ....... 7/0012 0.5833 SendGrid: http://sendgrid.com/
|
48
49
|
MSP::US::Verizon ........ 3/0003 1.0000 Verizon Wireless: http://www.verizonwireless.com
|
49
50
|
MSP::US::Yahoo .......... 0/0009 0.0000 Yahoo! MAIL: https://www.yahoo.com
|
50
51
|
MSP::US::Zoho ........... 0/0011 0.0000 Zoho Mail: https://www.zoho.com
|
51
52
|
ARF ..................... 9/0050 0.1800 Abuse Feedback Reporting Format
|
52
|
-
RFC3464 ................. 131/
|
53
|
+
RFC3464 ................. 131/0272 0.4816 Fallback Module for MTAs
|
53
54
|
RFC3834 ................. 0/0004 0.0000 Detector for auto replied message
|
54
55
|
-------------------------------------------------------------------------------
|
55
|
-
bounceHammer 2.7.13p3
|
56
|
-
Sisimai 4.
|
56
|
+
bounceHammer 2.7.13p3 1110/2145 0.5175
|
57
|
+
Sisimai 4.18.0 2145/2145 1.0000
|
data/Changes
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
Revision history for Ruby version of Sisimai
|
2
2
|
|
3
|
+
4.18.0 Mon, 22 Aug 2016 20:40:55 +0900 (JST)
|
4
|
+
- Import pull-request https://github.com/sisimai/rb-Sisimai/pull/59 (soft
|
5
|
+
bounce improvement) from Perl version of Sisimai.
|
6
|
+
- Sisimai::MTA::Exchange has been renamed to Sisimai::MTA::Exchange2003.
|
7
|
+
- Implement new MTA module Sisimai::MTA::Exchange2007.
|
8
|
+
|
3
9
|
4.17.2 Tue, 26 Jul 2016 21:00:17 +0900 (JST)
|
4
10
|
- Issue #174, Implement Sisimai::Rhost::ExchangeOnline for the bounce mail
|
5
11
|
from on-premises Exchange 2013 and Office 365.
|
data/README-JA.md
CHANGED
@@ -23,7 +23,7 @@ Sisimai(シシマイ)はRFC5322準拠のエラーメールを解析し、解析
|
|
23
23
|
* git clone & make
|
24
24
|
* __高い解析精度__
|
25
25
|
* 解析精度はbounceHammerの二倍
|
26
|
-
*
|
26
|
+
* 27種類のMTAに対応
|
27
27
|
* 21種類の著名なMSPに対応
|
28
28
|
* Feedback Loopにも対応
|
29
29
|
* 27種類のエラー理由を検出
|
@@ -148,8 +148,8 @@ Perl版Sisimaiとの違い
|
|
148
148
|
| メール解析速度(1000通のメール) | 3.30秒 | 2.33秒 |
|
149
149
|
| インストール方法 | gem install | cpanm |
|
150
150
|
| 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
|
151
|
-
| LOC:ソースコードの行数 |
|
152
|
-
| テスト件数(t/,xt/ディレクトリ) |
|
151
|
+
| LOC:ソースコードの行数 | 11500行 | 8400行 |
|
152
|
+
| テスト件数(t/,xt/ディレクトリ) | 95000件 | 172000件 |
|
153
153
|
| ライセンス | 二条項BSD | 二条項BSD |
|
154
154
|
| 開発会社によるサポート契約 | 準備中 | 提供中 |
|
155
155
|
|
@@ -167,7 +167,8 @@ MTA/MSPモジュール一覧
|
|
167
167
|
| MTA::ApacheJames | Java Apache Mail Enterprise Server |
|
168
168
|
| MTA::Courier | Courier MTA |
|
169
169
|
| MTA::Domino | IBM Domino Server |
|
170
|
-
| MTA::
|
170
|
+
| MTA::Exchange2003 | Microsoft Exchange Server 2003 |
|
171
|
+
| MTA::Exchange2007 | Microsoft Exchange Server 2007 (> v4.18.0) |
|
171
172
|
| MTA::Exim | Exim |
|
172
173
|
| MTA::IMailServer | IPSWITCH IMail Server |
|
173
174
|
| MTA::InterScanMSS | Trend Micro InterScan Messaging Security Suite |
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Key Features
|
|
22
22
|
* git clone & make
|
23
23
|
* __High Precision of Analysis__
|
24
24
|
* 2 times higher than bounceHammer
|
25
|
-
* Support
|
25
|
+
* Support 22 known MTAs and 5 unknown MTAs
|
26
26
|
* Support 21 major MSPs(Mail Service Providers)
|
27
27
|
* Support Feedback Loop Message(ARF)
|
28
28
|
* Can detect 27 error reasons
|
@@ -148,8 +148,8 @@ and bounceHammer are available at
|
|
148
148
|
| The speed of parsing email(1000 emails) | 3.30s | 2.33s |
|
149
149
|
| How to install | gem install | cpanm |
|
150
150
|
| Dependencies (Except core modules) | 1 modules | 2 modules |
|
151
|
-
| LOC:Source lines of code |
|
152
|
-
| The number of tests in t/, xt/ directory |
|
151
|
+
| LOC:Source lines of code | 11500 lines | 8400 lines |
|
152
|
+
| The number of tests in t/, xt/ directory | 95000 tests | 172000 tests |
|
153
153
|
| License | BSD 2-Clause | BSD 2-Clause |
|
154
154
|
| Support Contract provided by Developer | Coming soon | Available |
|
155
155
|
|
@@ -167,7 +167,8 @@ details about these modules are available at
|
|
167
167
|
| MTA::ApacheJames | Java Apache Mail Enterprise Server |
|
168
168
|
| MTA::Courier | Courier MTA |
|
169
169
|
| MTA::Domino | IBM Domino Server |
|
170
|
-
| MTA::
|
170
|
+
| MTA::Exchange2003 | Microsoft Exchange Server 2003 |
|
171
|
+
| MTA::Exchange2007 | Microsoft Exchange Server 2007 (> v4.18.0) |
|
171
172
|
| MTA::Exim | Exim |
|
172
173
|
| MTA::IMailServer | IPSWITCH IMail Server |
|
173
174
|
| MTA::InterScanMSS | Trend Micro InterScan Messaging Security Suite |
|
data/Repository.mk
CHANGED
@@ -26,7 +26,7 @@ git-status:
|
|
26
26
|
git-push:
|
27
27
|
@ for v in `$(GIT) remote show | grep -v origin`; do \
|
28
28
|
printf "[%s]\n" $$v; \
|
29
|
-
$(GIT) push --tags $$v
|
29
|
+
$(GIT) push --tags $$v `$(MAKE) -f Repository.mk git-current-branch`; \
|
30
30
|
done
|
31
31
|
|
32
32
|
git-tag-list:
|
@@ -41,6 +41,9 @@ git-branch:
|
|
41
41
|
git-commit-amend:
|
42
42
|
$(GIT) commit --amend
|
43
43
|
|
44
|
+
git-current-branch:
|
45
|
+
@$(GIT) branch --contains=HEAD | grep '*' | awk '{ print $$2 }'
|
46
|
+
|
44
47
|
git-follow-log:
|
45
48
|
$(GIT) log --follow -p $(V) || \
|
46
49
|
printf "\nUsage:\n %% make -f Repository.mk $@ V=<filename>\n"
|
data/lib/sisimai/data.rb
CHANGED
@@ -4,6 +4,7 @@ module Sisimai
|
|
4
4
|
# Imported from p5-Sisimail/lib/Sisimai/Data.pm
|
5
5
|
require 'sisimai/address'
|
6
6
|
require 'sisimai/rfc5322'
|
7
|
+
require 'sisimai/smtp/error'
|
7
8
|
require 'sisimai/smtp/reply'
|
8
9
|
require 'sisimai/smtp/status'
|
9
10
|
require 'sisimai/string'
|
@@ -96,7 +97,6 @@ module Sisimai
|
|
96
97
|
@replycode = argvs['replycode'] || ''
|
97
98
|
@replycode = Sisimai::SMTP::Reply.find(argvs['diagnosticcode']) if @replycode.empty?
|
98
99
|
@softbounce = argvs['softbounce'] || ''
|
99
|
-
@softbounce = 1 if @replycode =~ /\A4/
|
100
100
|
end
|
101
101
|
|
102
102
|
# Another constructor of Sisimai::Data
|
@@ -336,40 +336,58 @@ module Sisimai
|
|
336
336
|
o.reason = r
|
337
337
|
end
|
338
338
|
|
339
|
-
if o.reason
|
339
|
+
if o.reason =~ /\A(?:delivered|feedback|vacation)\z/
|
340
|
+
# The value of reason is "vacation" or "feedback"
|
341
|
+
o.softbounce = -1
|
342
|
+
o.replycode = '' unless o.reason == 'delivered'
|
343
|
+
else
|
340
344
|
# Bounce message which reason is "feedback" or "vacation" does
|
341
345
|
# not have the value of "deliverystatus".
|
346
|
+
softorhard = nil
|
347
|
+
textasargv = nil
|
348
|
+
|
342
349
|
if o.softbounce.to_s.empty?
|
343
350
|
# The value is not set yet
|
344
|
-
%
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
351
|
+
textasargv = sprintf('%s %s', p['deliverystatus'], p['diagnosticcode'])
|
352
|
+
textasargv = textasargv.gsub(/\A[ ]/, '')
|
353
|
+
softorhard = Sisimai::SMTP::Error.soft_or_hard(o.reason, textasargv)
|
354
|
+
|
355
|
+
if softorhard.size > 0
|
356
|
+
# Returned value is "soft" or "hard"
|
357
|
+
o.softbounce = (softorhard == 'soft') ? 1 : 0
|
358
|
+
else
|
359
|
+
# Returned value is an empty string
|
360
|
+
o.softbounce = (-1)
|
354
361
|
end
|
355
|
-
o.softbounce = -1 if o.softbounce.to_s.empty?
|
356
362
|
end
|
357
363
|
|
358
364
|
if o.deliverystatus.empty?
|
359
365
|
# Set pseudo status code
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
366
|
+
pseudocode = nil # Pseudo delivery status code
|
367
|
+
getchecked = nil # Permanent error or not
|
368
|
+
tmpfailure = nil # Temporary error or not
|
369
|
+
|
370
|
+
textasargv = sprintf('%s %s', o.replycode, p['diagnosticcode'])
|
371
|
+
textasargv = textasargv.gsub(/\A[ ]/, '')
|
372
|
+
|
373
|
+
getchecked = Sisimai::SMTP::Error.is_permanent(textasargv)
|
374
|
+
tmpfailure = getchecked.nil? ? false : (getchecked ? false : true)
|
375
|
+
pseudocode = Sisimai::SMTP::Status.code(o.reason, tmpfailure)
|
376
|
+
|
377
|
+
if pseudocode.size > 0
|
378
|
+
# Set the value of "deliverystatus" and "softbounce"
|
379
|
+
o.deliverystatus = pseudocode
|
380
|
+
|
381
|
+
if o.softbounce < 0
|
382
|
+
# set the value of "softbounce" again when the value is -1
|
383
|
+
softorhard = Sisimai::SMTP::Error.soft_or_hard(o.reason, pseudocode)
|
384
|
+
|
385
|
+
if softorhard.size > 0
|
386
|
+
# Returned value is "soft" or "hard"
|
387
|
+
o.softbounce = softorhard == 'soft' ? 1 : 0
|
371
388
|
else
|
372
|
-
|
389
|
+
# Returned value is an empty string
|
390
|
+
o.softbounce = -1
|
373
391
|
end
|
374
392
|
end
|
375
393
|
end
|
@@ -380,12 +398,9 @@ module Sisimai
|
|
380
398
|
o.replycode = '' unless o.replycode[0, 1] == o.deliverystatus[0, 1]
|
381
399
|
end
|
382
400
|
|
383
|
-
else
|
384
|
-
# The value of reason is "vacation" or "feedback"
|
385
|
-
o.softbounce = -1
|
386
|
-
o.replycode = ''
|
387
401
|
end
|
388
402
|
objectlist << o
|
403
|
+
|
389
404
|
end
|
390
405
|
return objectlist
|
391
406
|
end
|
@@ -146,11 +146,7 @@ module Sisimai
|
|
146
146
|
# host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
|
147
147
|
v = dscontents[-1]
|
148
148
|
|
149
|
-
if
|
150
|
-
# recipients. This is a permanent error. The following address(es) failed:
|
151
|
-
v['softbounce'] = 0
|
152
|
-
|
153
|
-
elsif cv = e.match(/\A[ \t]+([^ \t]+[@][^ \t]+[.][a-zA-Z]+)\z/)
|
149
|
+
if cv = e.match(/\A[ \t]+([^ \t]+[@][^ \t]+[.][a-zA-Z]+)\z/)
|
154
150
|
# kijitora@example.jp
|
155
151
|
if v['recipient']
|
156
152
|
# There are multiple recipient addresses in the message body.
|
@@ -134,7 +134,6 @@ module Sisimai
|
|
134
134
|
# Status:5.2.0
|
135
135
|
# Status: 5.1.0 (permanent failure)
|
136
136
|
v['status'] = cv[1]
|
137
|
-
v['softbounce'] = 0 if e =~ /[(]permanent failure[)]/
|
138
137
|
|
139
138
|
elsif cv = e.match(/\A[Rr]emote-MTA:[ ]*(?:DNS|dns);[ ]*(.+)\z/)
|
140
139
|
# Remote-MTA: DNS; mx.example.jp
|
@@ -235,7 +235,6 @@ module Sisimai
|
|
235
235
|
num = cv[3]
|
236
236
|
|
237
237
|
fbresponse = sprintf('%s-%s%d', lhs, rhs, num)
|
238
|
-
e['softbounce'] = rhs == 'P' ? 0 : 1
|
239
238
|
end
|
240
239
|
|
241
240
|
catch :SESSION do
|
@@ -263,7 +262,6 @@ module Sisimai
|
|
263
262
|
# This block has not been tested because we have no email sample
|
264
263
|
# including "INT-T?" error code.
|
265
264
|
e['reason'] = 'systemerror'
|
266
|
-
e['softbounce'] = 1
|
267
265
|
end
|
268
266
|
end
|
269
267
|
end
|
@@ -253,11 +253,6 @@ module Sisimai
|
|
253
253
|
end
|
254
254
|
|
255
255
|
else
|
256
|
-
if cv = e.match(/Technical details of (.+) failure:/)
|
257
|
-
# Technical details of permanent failure:
|
258
|
-
# Technical details of temporary failure:
|
259
|
-
v['softbounce'] = cv[1] == 'permanent' ? 0 : 1
|
260
|
-
end
|
261
256
|
v['diagnosis'] ||= ''
|
262
257
|
v['diagnosis'] += e + ' '
|
263
258
|
end
|
@@ -187,17 +187,10 @@ module Sisimai
|
|
187
187
|
dscontents.map do |e|
|
188
188
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
189
189
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
else
|
195
|
-
# Get the value of SMTP status code as a pseudo D.S.N.
|
196
|
-
if cv = e['diagnosis'].match(/\b([45])\d\d[ \t]*/)
|
197
|
-
# 4xx or 5xx
|
198
|
-
e['softbounce'] = 1 if cv[1].to_i == 4
|
199
|
-
e['status'] = sprintf("%d.0.0", cv[1])
|
200
|
-
end
|
190
|
+
# Get the value of SMTP status code as a pseudo D.S.N.
|
191
|
+
if cv = e['diagnosis'].match(/\b([45])\d\d[ \t]*/)
|
192
|
+
# 4xx or 5xx
|
193
|
+
e['status'] = sprintf("%d.0.0", cv[1])
|
201
194
|
end
|
202
195
|
|
203
196
|
if e['status'] =~ /[45][.]0[.]0/
|
data/lib/sisimai/mta.rb
CHANGED
@@ -30,6 +30,7 @@ module Sisimai
|
|
30
30
|
'status' => nil, # The value of Status header
|
31
31
|
'reason' => nil, # Temporary reason of bounce
|
32
32
|
'command' => nil, # SMTP command in the message body
|
33
|
+
'replycode' => nil, # SMTP Reply code
|
33
34
|
'diagnosis' => nil, # The value of Diagnostic-Code header
|
34
35
|
'recipient' => nil, # The value of Final-Recipient header
|
35
36
|
'softbounce' => nil, # Soft bounce or not
|
@@ -41,9 +42,9 @@ module Sisimai
|
|
41
42
|
# @return [Array] MTA list with order
|
42
43
|
def index
|
43
44
|
return %w|
|
44
|
-
Sendmail Postfix Qmail Exim Courier OpenSMTPD
|
45
|
-
Domino Notes ApacheJames McAfee MXLogic MailFoundry
|
46
|
-
Activehunter InterScanMSS SurfControl MailMarshalSMTP
|
45
|
+
Sendmail Postfix Qmail Exim Courier OpenSMTPD Exchange2007 Exchange2003
|
46
|
+
MessagingServer Domino Notes ApacheJames McAfee MXLogic MailFoundry
|
47
|
+
IMailServer MFILTER Activehunter InterScanMSS SurfControl MailMarshalSMTP
|
47
48
|
X1 X2 X3 X4 X5 V5sendmail
|
48
49
|
|
|
49
50
|
end
|
data/lib/sisimai/mta/courier.rb
CHANGED
@@ -240,7 +240,6 @@ module Sisimai
|
|
240
240
|
# Verify each regular expression of session errors
|
241
241
|
next unless e['diagnosis'] =~ ReFailure[r]
|
242
242
|
e['reason'] = r.to_s
|
243
|
-
e['softbounce'] = 0
|
244
243
|
break
|
245
244
|
end
|
246
245
|
|
@@ -249,7 +248,6 @@ module Sisimai
|
|
249
248
|
# Verify each regular expression of session errors
|
250
249
|
next unless e['diagnosis'] =~ ReDelayed[r]
|
251
250
|
e['reason'] = r.to_s
|
252
|
-
e['softbounce'] = 1
|
253
251
|
break
|
254
252
|
end
|
255
253
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module MTA
|
3
|
-
# Sisimai::MTA::
|
4
|
-
# Exchange Server
|
5
|
-
module
|
6
|
-
|
3
|
+
# Sisimai::MTA::Exchange2003 parses a bounce email which created by Microsoft
|
4
|
+
# Exchange Server 2003.
|
5
|
+
# Methods in the module are called from only Sisimai::Message.
|
6
|
+
module Exchange2003
|
7
|
+
# Imported from p5-Sisimail/lib/Sisimai/MTA/Exchange2003.pm
|
7
8
|
class << self
|
8
9
|
require 'sisimai/mta'
|
9
10
|
require 'sisimai/rfc5322'
|
@@ -55,12 +56,12 @@ module Sisimai
|
|
55
56
|
}
|
56
57
|
Indicators = Sisimai::MTA.INDICATORS
|
57
58
|
|
58
|
-
def description; return 'Microsoft Exchange Server'; end
|
59
|
-
def smtpagent; return '
|
59
|
+
def description; return 'Microsoft Exchange Server 2003'; end
|
60
|
+
def smtpagent; return 'Exchange2003'; end
|
60
61
|
def headerlist; return ['X-MS-Embedded-Report', 'X-MimeOLE']; end
|
61
62
|
def pattern; return Re0; end
|
62
63
|
|
63
|
-
# Parse bounce messages from Microsoft Exchange Server
|
64
|
+
# Parse bounce messages from Microsoft Exchange Server 2003
|
64
65
|
# @param [Hash] mhead Message header of a bounce email
|
65
66
|
# @options mhead [String] from From header
|
66
67
|
# @options mhead [String] date Date header
|
@@ -263,7 +264,7 @@ module Sisimai
|
|
263
264
|
e.delete('alterrors')
|
264
265
|
end
|
265
266
|
end
|
266
|
-
e['agent'] = Sisimai::MTA::
|
267
|
+
e['agent'] = Sisimai::MTA::Exchange2003.smtpagent
|
267
268
|
e.delete('msexch')
|
268
269
|
e.each_key { |a| e[a] ||= '' }
|
269
270
|
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module MTA
|
3
|
+
# Sisimai::MTA::Exchange2007 parses a bounce email which created by Microsoft
|
4
|
+
# Exchange Server 2007.
|
5
|
+
# Methods in the module are called from only Sisimai::Message.
|
6
|
+
module Exchange2007
|
7
|
+
# Imported from p5-Sisimail/lib/Sisimai/MTA/Exchange2007.pm
|
8
|
+
class << self
|
9
|
+
require 'sisimai/mta'
|
10
|
+
require 'sisimai/rfc5322'
|
11
|
+
|
12
|
+
Re0 = {
|
13
|
+
:'subject' => %r/\AUndeliverable:/,
|
14
|
+
:'content-language' => %r/\A[a-z]{2}(?:[-][A-Z]{2})?\z/,
|
15
|
+
}
|
16
|
+
Re1 = {
|
17
|
+
:begin => %r/[ ]Microsoft[ ]Exchange[ ]Server[ ]20\d{2}/,
|
18
|
+
:error => %r/[ ]((?:RESOLVER|QUEUE)[.][A-Za-z]+(?:[.]\w+)?);/,
|
19
|
+
:rhost => %r/\AGenerating[ ]server:[ ]?(.*)/,
|
20
|
+
:rfc822 => %r/\AOriginal message headers:/,
|
21
|
+
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
22
|
+
}
|
23
|
+
NDRSubject = {
|
24
|
+
:'RESOLVER.ADR.RecipNotFound' => 'userunknown',
|
25
|
+
:'RESOLVER.RST.RecipSizeLimit' => 'mesgtoobig',
|
26
|
+
:'QUEUE.Expired' => 'expired',
|
27
|
+
}
|
28
|
+
Indicators = Sisimai::MTA.INDICATORS
|
29
|
+
|
30
|
+
def description; return 'Microsoft Exchange Server 2007'; end
|
31
|
+
def smtpagent; return 'Exchange2007'; end
|
32
|
+
def headerlist; return ['Content-Language']; end
|
33
|
+
def pattern; return Re0; end
|
34
|
+
|
35
|
+
# Parse bounce messages from Microsoft Exchange Server 2007
|
36
|
+
# @param [Hash] mhead Message header of a bounce email
|
37
|
+
# @options mhead [String] from From header
|
38
|
+
# @options mhead [String] date Date header
|
39
|
+
# @options mhead [String] subject Subject header
|
40
|
+
# @options mhead [Array] received Received headers
|
41
|
+
# @options mhead [String] others Other required headers
|
42
|
+
# @param [String] mbody Message body of a bounce email
|
43
|
+
# @return [Hash, Nil] Bounce data list and message/rfc822
|
44
|
+
# part or nil if it failed to parse or
|
45
|
+
# the arguments are missing
|
46
|
+
def scan(mhead, mbody)
|
47
|
+
return nil unless mhead
|
48
|
+
return nil unless mbody
|
49
|
+
|
50
|
+
return nil unless mhead['subject'] =~ Re0[:'subject']
|
51
|
+
return nil unless mhead['content-language']
|
52
|
+
return nil unless mhead['content-language'] =~ Re0[:'content-language']
|
53
|
+
|
54
|
+
dscontents = [Sisimai::MTA.DELIVERYSTATUS]
|
55
|
+
hasdivided = mbody.split("\n")
|
56
|
+
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
57
|
+
blanklines = 0 # (Integer) The number of blank lines
|
58
|
+
readcursor = 0 # (Integer) Points the current cursor position
|
59
|
+
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
60
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
|
61
|
+
connheader = {
|
62
|
+
'rhost' => '', # The value of Reporting-MTA header or "Generating Server:"
|
63
|
+
}
|
64
|
+
v = nil
|
65
|
+
|
66
|
+
hasdivided.each do |e|
|
67
|
+
if readcursor == 0
|
68
|
+
# Beginning of the bounce message or delivery status part
|
69
|
+
if e =~ Re1[:begin]
|
70
|
+
readcursor |= Indicators[:deliverystatus]
|
71
|
+
next
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if readcursor & Indicators[:'message-rfc822'] == 0
|
76
|
+
# Beginning of the original message part
|
77
|
+
if e =~ Re1[:rfc822]
|
78
|
+
readcursor |= Indicators[:'message-rfc822']
|
79
|
+
next
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
if readcursor & Indicators[:'message-rfc822'] > 0
|
84
|
+
# After "message/rfc822"
|
85
|
+
if e.empty?
|
86
|
+
blanklines += 1
|
87
|
+
break if blanklines > 1
|
88
|
+
next
|
89
|
+
end
|
90
|
+
rfc822list << e
|
91
|
+
|
92
|
+
else
|
93
|
+
# Before "message/rfc822"
|
94
|
+
next if readcursor & Indicators[:deliverystatus] == 0
|
95
|
+
|
96
|
+
if connvalues == connheader.keys.size
|
97
|
+
# Diagnostic information for administrators:
|
98
|
+
#
|
99
|
+
# Generating server: mta2.neko.example.jp
|
100
|
+
#
|
101
|
+
# kijitora@example.jp
|
102
|
+
# #550 5.1.1 RESOLVER.ADR.RecipNotFound; not found ##
|
103
|
+
#
|
104
|
+
# Original message headers:
|
105
|
+
v = dscontents[-1]
|
106
|
+
|
107
|
+
if cv = e.match(/\A([^ @]+[@][^ @]+)\z/)
|
108
|
+
# kijitora@example.jp
|
109
|
+
if v['recipient']
|
110
|
+
# There are multiple recipient addresses in the message body.
|
111
|
+
dscontents << Sisimai::MTA.DELIVERYSTATUS
|
112
|
+
v = dscontents[-1]
|
113
|
+
end
|
114
|
+
v['recipient'] = cv[1]
|
115
|
+
recipients += 1
|
116
|
+
|
117
|
+
elsif cv = e.match(/\A[#]([45]\d{2})[ ]([45][.]\d[.]\d+)[ ].+\z/)
|
118
|
+
# #550 5.1.1 RESOLVER.ADR.RecipNotFound; not found ##
|
119
|
+
# #550 5.2.3 RESOLVER.RST.RecipSizeLimit; message too large for this recipien=
|
120
|
+
# t ##
|
121
|
+
v['replycode'] = cv[1]
|
122
|
+
v['status'] = cv[2]
|
123
|
+
v['diagnosis'] = e
|
124
|
+
|
125
|
+
else
|
126
|
+
if v['diagnosis'].to_s.size > 0 && v['diagnosis'] =~ /=\z/
|
127
|
+
# Continued line of error messages
|
128
|
+
v['diagnosis'] = v['diagnosis'].sub(/=\z/, '')
|
129
|
+
v['diagnosis'] += e
|
130
|
+
end
|
131
|
+
end
|
132
|
+
else
|
133
|
+
# Diagnostic information for administrators:
|
134
|
+
#
|
135
|
+
# Generating server: mta22.neko.example.org
|
136
|
+
if cv = e.match(Re1[:rhost])
|
137
|
+
# Generating server: mta22.neko.example.org
|
138
|
+
next if connheader['rhost'].size > 0
|
139
|
+
connheader['rhost'] = cv[1]
|
140
|
+
connvalues += 1
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
return nil if recipients == 0
|
146
|
+
|
147
|
+
require 'sisimai/string'
|
148
|
+
dscontents.map do |e|
|
149
|
+
if cv = e['diagnosis'].match(Re1[:error])
|
150
|
+
# #550 5.1.1 RESOLVER.ADR.RecipNotFound; not found ##
|
151
|
+
f = cv[1]
|
152
|
+
NDRSubject.each_key do |r|
|
153
|
+
# Try to match with error subject strings
|
154
|
+
next unless f == r.to_s
|
155
|
+
e['reason'] = NDRSubject[r]
|
156
|
+
break
|
157
|
+
end
|
158
|
+
end
|
159
|
+
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
160
|
+
e['agent'] = Sisimai::MTA::Exchange2007.smtpagent
|
161
|
+
end
|
162
|
+
|
163
|
+
rfc822part = Sisimai::RFC5322.weedout(rfc822list)
|
164
|
+
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|