sisimai 5.1.0-java → 5.2.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake-test.yml +1 -1
- data/ChangeLog.md +102 -0
- data/Makefile +4 -2
- data/README-JA.md +23 -16
- data/README.md +22 -15
- data/lib/sisimai/arf.rb +121 -210
- data/lib/sisimai/fact.rb +208 -158
- data/lib/sisimai/lda.rb +98 -0
- data/lib/sisimai/lhost/activehunter.rb +1 -1
- data/lib/sisimai/lhost/amazonses.rb +185 -301
- data/lib/sisimai/lhost/apachejames.rb +48 -51
- data/lib/sisimai/lhost/biglobe.rb +1 -2
- data/lib/sisimai/lhost/courier.rb +10 -8
- data/lib/sisimai/lhost/domino.rb +25 -25
- data/lib/sisimai/lhost/dragonfly.rb +3 -4
- data/lib/sisimai/lhost/einsundeins.rb +3 -4
- data/lib/sisimai/lhost/exchange2003.rb +6 -8
- data/lib/sisimai/lhost/exchange2007.rb +111 -101
- data/lib/sisimai/lhost/exim.rb +232 -242
- data/lib/sisimai/lhost/ezweb.rb +43 -51
- data/lib/sisimai/lhost/fml.rb +2 -3
- data/lib/sisimai/lhost/gmail.rb +32 -28
- data/lib/sisimai/lhost/gmx.rb +4 -16
- data/lib/sisimai/lhost/googlegroups.rb +9 -8
- data/lib/sisimai/lhost/googleworkspace.rb +94 -0
- data/lib/sisimai/lhost/imailserver.rb +7 -16
- data/lib/sisimai/lhost/interscanmss.rb +1 -1
- data/lib/sisimai/lhost/kddi.rb +3 -4
- data/lib/sisimai/lhost/mailfoundry.rb +2 -5
- data/lib/sisimai/lhost/mailmarshalsmtp.rb +1 -2
- data/lib/sisimai/lhost/messagingserver.rb +14 -13
- data/lib/sisimai/lhost/mfilter.rb +4 -3
- data/lib/sisimai/lhost/notes.rb +2 -4
- data/lib/sisimai/lhost/opensmtpd.rb +2 -2
- data/lib/sisimai/lhost/postfix.rb +25 -27
- data/lib/sisimai/lhost/qmail.rb +130 -106
- data/lib/sisimai/lhost/sendmail.rb +19 -18
- data/lib/sisimai/lhost/v5sendmail.rb +88 -60
- data/lib/sisimai/lhost/verizon.rb +2 -2
- data/lib/sisimai/lhost/x1.rb +1 -1
- data/lib/sisimai/lhost/x2.rb +1 -2
- data/lib/sisimai/lhost/x3.rb +2 -2
- data/lib/sisimai/lhost/x6.rb +1 -1
- data/lib/sisimai/lhost/zoho.rb +2 -2
- data/lib/sisimai/lhost.rb +18 -21
- data/lib/sisimai/message.rb +93 -146
- data/lib/sisimai/order.rb +21 -77
- data/lib/sisimai/reason/authfailure.rb +1 -4
- data/lib/sisimai/reason/badreputation.rb +2 -2
- data/lib/sisimai/reason/blocked.rb +7 -10
- data/lib/sisimai/reason/contenterror.rb +7 -1
- data/lib/sisimai/reason/exceedlimit.rb +1 -4
- data/lib/sisimai/reason/failedstarttls.rb +42 -0
- data/lib/sisimai/reason/filtered.rb +5 -4
- data/lib/sisimai/reason/hasmoved.rb +1 -2
- data/lib/sisimai/reason/hostunknown.rb +3 -3
- data/lib/sisimai/reason/mailboxfull.rb +2 -4
- data/lib/sisimai/reason/mailererror.rb +1 -2
- data/lib/sisimai/reason/mesgtoobig.rb +2 -4
- data/lib/sisimai/reason/norelaying.rb +2 -3
- data/lib/sisimai/reason/notaccept.rb +2 -3
- data/lib/sisimai/reason/notcompliantrfc.rb +10 -4
- data/lib/sisimai/reason/rejected.rb +1 -1
- data/lib/sisimai/reason/requireptr.rb +2 -2
- data/lib/sisimai/reason/securityerror.rb +1 -3
- data/lib/sisimai/reason/spamdetected.rb +6 -8
- data/lib/sisimai/reason/speeding.rb +1 -2
- data/lib/sisimai/reason/suppressed.rb +36 -0
- data/lib/sisimai/reason/suspend.rb +1 -3
- data/lib/sisimai/reason/systemerror.rb +5 -0
- data/lib/sisimai/reason/toomanyconn.rb +1 -2
- data/lib/sisimai/reason/userunknown.rb +1 -1
- data/lib/sisimai/reason/virusdetected.rb +5 -6
- data/lib/sisimai/reason.rb +77 -73
- data/lib/sisimai/rfc1123.rb +152 -0
- data/lib/sisimai/rfc1894.rb +102 -62
- data/lib/sisimai/rfc2045.rb +2 -1
- data/lib/sisimai/rfc3464/thirdparty.rb +102 -0
- data/lib/sisimai/rfc3464.rb +222 -343
- data/lib/sisimai/rfc3834.rb +1 -1
- data/lib/sisimai/rfc5322.rb +7 -17
- data/lib/sisimai/rfc791.rb +69 -0
- data/lib/sisimai/rhost/aol.rb +36 -0
- data/lib/sisimai/rhost/apple.rb +5 -2
- data/lib/sisimai/rhost/cox.rb +3 -2
- data/lib/sisimai/rhost/facebook.rb +100 -0
- data/lib/sisimai/rhost/franceptt.rb +3 -2
- data/lib/sisimai/rhost/godaddy.rb +3 -2
- data/lib/sisimai/rhost/google.rb +19 -17
- data/lib/sisimai/rhost/gsuite.rb +42 -0
- data/lib/sisimai/rhost/iua.rb +3 -3
- data/lib/sisimai/rhost/kddi.rb +3 -2
- data/lib/sisimai/rhost/messagelabs.rb +37 -0
- data/lib/sisimai/rhost/microsoft.rb +56 -49
- data/lib/sisimai/rhost/mimecast.rb +29 -27
- data/lib/sisimai/rhost/nttdocomo.rb +4 -3
- data/lib/sisimai/rhost/outlook.rb +36 -0
- data/lib/sisimai/rhost/spectrum.rb +3 -2
- data/lib/sisimai/rhost/tencent.rb +3 -2
- data/lib/sisimai/rhost/yahooinc.rb +4 -3
- data/lib/sisimai/rhost.rb +69 -39
- data/lib/sisimai/smtp/command.rb +31 -21
- data/lib/sisimai/smtp/failure.rb +103 -0
- data/lib/sisimai/smtp/reply.rb +29 -25
- data/lib/sisimai/smtp/status.rb +36 -19
- data/lib/sisimai/smtp/transcript.rb +15 -15
- data/lib/sisimai/string.rb +0 -46
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/lhost-postfix-30.eml +81 -81
- data/set-of-emails/maildir/bsd/{lhost-aol-03.eml → rhost-aol-03.eml} +1264 -1264
- data/set-of-emails/maildir/bsd/{lhost-aol-04.eml → rhost-aol-04.eml} +1260 -1260
- data/set-of-emails/maildir/bsd/{lhost-aol-05.eml → rhost-aol-05.eml} +105 -105
- data/set-of-emails/maildir/bsd/{lhost-aol-06.eml → rhost-aol-06.eml} +105 -105
- data/set-of-emails/maildir/bsd/rhost-gsuite-01.eml +189 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-02.eml +180 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-03.eml +251 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-04.eml +211 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-05.eml +226 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-06.eml +257 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-07.eml +289 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-08.eml +231 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-09.eml +231 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-10.eml +254 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-11.eml +228 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-12.eml +271 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-13.eml +261 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-14.eml +273 -0
- data/set-of-emails/maildir/bsd/rhost-gsuite-15.eml +229 -0
- data/set-of-emails/maildir/bsd/{lhost-messagelabs-01.eml → rhost-messagelabs-01.eml} +93 -93
- data/set-of-emails/maildir/bsd/rhost-outlook-01.eml +72 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-02.eml +72 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-03.eml +72 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-04.eml +79 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-06.eml +75 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-07.eml +70 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-08.eml +70 -0
- data/set-of-emails/maildir/bsd/rhost-outlook-09.eml +56 -0
- data/set-of-emails/maildir/tmp/arf-22.eml +49 -0
- data/set-of-emails/maildir/tmp/arf-23.eml +49 -0
- data/set-of-emails/maildir/tmp/arf-24.eml +50 -0
- data/set-of-emails/maildir/tmp/lhost-exim-07.eml +28 -0
- metadata +73 -56
- data/lib/sisimai/lhost/amavis.rb +0 -163
- data/lib/sisimai/lhost/amazonworkmail.rb +0 -127
- data/lib/sisimai/lhost/aol.rb +0 -125
- data/lib/sisimai/lhost/barracuda.rb +0 -92
- data/lib/sisimai/lhost/bigfoot.rb +0 -125
- data/lib/sisimai/lhost/facebook.rb +0 -188
- data/lib/sisimai/lhost/gsuite.rb +0 -194
- data/lib/sisimai/lhost/mailru.rb +0 -214
- data/lib/sisimai/lhost/mcafee.rb +0 -109
- data/lib/sisimai/lhost/messagelabs.rb +0 -120
- data/lib/sisimai/lhost/mxlogic.rb +0 -198
- data/lib/sisimai/lhost/office365.rb +0 -252
- data/lib/sisimai/lhost/outlook.rb +0 -129
- data/lib/sisimai/lhost/powermta.rb +0 -118
- data/lib/sisimai/lhost/receivingses.rb +0 -126
- data/lib/sisimai/lhost/sendgrid.rb +0 -150
- data/lib/sisimai/lhost/surfcontrol.rb +0 -105
- data/lib/sisimai/lhost/x4.rb +0 -269
- data/lib/sisimai/lhost/x5.rb +0 -112
- data/lib/sisimai/lhost/yahoo.rb +0 -102
- data/lib/sisimai/lhost/yandex.rb +0 -118
- data/lib/sisimai/mda.rb +0 -121
- data/lib/sisimai/smtp/error.rb +0 -119
- /data/set-of-emails/maildir/bsd/{lhost-googlegroups-15.eml → lhost-googleworkspace-01.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-x4-08.eml → lhost-x2-06.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-01.eml → rfc3464-51.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-03.eml → rfc3464-52.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-04.eml → rfc3464-53.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-05.eml → rfc3464-54.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-06.eml → rfc3464-55.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-07.eml → rfc3464-56.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-08.eml → rfc3464-57.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-09.eml → rfc3464-58.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-10.eml → rfc3464-59.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-11.eml → rfc3464-60.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-12.eml → rfc3464-61.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-13.eml → rfc3464-62.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-14.eml → rfc3464-63.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-15.eml → rfc3464-64.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-gsuite-02.eml → rfc3464-65.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-aol-01.eml → rhost-aol-01.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-aol-02.eml → rhost-aol-02.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-facebook-03.eml → rhost-facebook-03.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-facebook-04.eml → rhost-facebook-04.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-messagelabs-02.eml → rhost-messagelabs-02.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{lhost-messagelabs-03.eml → rhost-messagelabs-03.eml} +0 -0
- /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-37.eml +0 -0
- /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-38.eml +0 -0
- /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-39.eml +0 -0
@@ -6,13 +6,12 @@ module Sisimai::Lhost
|
|
6
6
|
require 'sisimai/lhost'
|
7
7
|
|
8
8
|
Indicators = Sisimai::Lhost.INDICATORS
|
9
|
-
Boundaries = [
|
9
|
+
Boundaries = ["Content-Type: message/rfc822"].freeze
|
10
10
|
StartingOf = {
|
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: [
|
15
|
-
error: ['Error message below:'],
|
14
|
+
message: ["Message details:"],
|
16
15
|
}.freeze
|
17
16
|
|
18
17
|
# @abstract decodes the bounce message from Apache James
|
@@ -22,28 +21,31 @@ module Sisimai::Lhost
|
|
22
21
|
# @return [Nil] it failed to decode or the arguments are missing
|
23
22
|
def inquire(mhead, mbody)
|
24
23
|
match = 0
|
25
|
-
match += 1 if mhead[
|
26
|
-
match += 1 if mhead[
|
27
|
-
match += 1 if mhead[
|
24
|
+
match += 1 if mhead["subject"] == "[BOUNCE]"
|
25
|
+
match += 1 if mhead["message-id"].to_s.include?(".JavaMail.")
|
26
|
+
match += 1 if mhead["received"].any? { |a| a.include?("JAMES SMTP Server") }
|
28
27
|
return nil unless match > 0
|
29
28
|
|
30
29
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
31
30
|
emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
|
32
31
|
bodyslices = emailparts[0].split("\n")
|
33
|
-
readcursor = 0
|
34
|
-
recipients = 0
|
35
|
-
|
36
|
-
|
37
|
-
gotmessage = nil # (Boolean) Flag for error message
|
38
|
-
v = nil
|
32
|
+
readcursor = 0 # Points the current cursor position
|
33
|
+
recipients = 0 # The number of 'Final-Recipient' header
|
34
|
+
alternates = ["", "", "", ""] # [Envelope-From, Header-From, Date, Subject]
|
35
|
+
v = dscontents[-1]
|
39
36
|
|
40
37
|
while e = bodyslices.shift do
|
41
38
|
# Read error messages and delivery status lines from the head of the email to the previous
|
42
39
|
# line of the beginning of the original message.
|
43
|
-
|
44
40
|
if readcursor == 0
|
45
41
|
# Beginning of the bounce message or delivery status part
|
46
|
-
|
42
|
+
if e.start_with?(StartingOf[:message][0])
|
43
|
+
# Message details:
|
44
|
+
# Subject: Nyaaan
|
45
|
+
readcursor |= Indicators[:deliverystatus]
|
46
|
+
next
|
47
|
+
end
|
48
|
+
v["diagnosis"] << e << " " if e != ""
|
47
49
|
next
|
48
50
|
end
|
49
51
|
next if (readcursor & Indicators[:deliverystatus]) == 0
|
@@ -58,58 +60,53 @@ module Sisimai::Lhost
|
|
58
60
|
# To: kijitora@example.org
|
59
61
|
# Size (in bytes): 1024
|
60
62
|
# Number of lines: 64
|
61
|
-
|
62
|
-
|
63
|
-
if e.start_with?(' RCPT TO: ')
|
63
|
+
if e.start_with?(" RCPT TO: ")
|
64
64
|
# RCPT TO: kijitora@example.org
|
65
|
-
if v[
|
65
|
+
if v["recipient"] != ""
|
66
66
|
# There are multiple recipient addresses in the message body.
|
67
67
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
68
68
|
v = dscontents[-1]
|
69
69
|
end
|
70
|
-
v[
|
70
|
+
v["recipient"] = e[12, e.size]
|
71
71
|
recipients += 1
|
72
72
|
|
73
|
-
elsif e.start_with?(
|
73
|
+
elsif e.start_with?(" Sent date: ")
|
74
74
|
# Sent date: Thu Apr 29 01:20:50 JST 2015
|
75
|
-
v[
|
75
|
+
v["date"] = e[13, e.size]
|
76
|
+
alternates[2] = v["date"]
|
76
77
|
|
77
|
-
elsif e.start_with?(
|
78
|
+
elsif e.start_with?(" Subject: ")
|
78
79
|
# Subject: Nyaaan
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
else
|
90
|
-
# Append error message text like the followng:
|
91
|
-
# Error message below:
|
92
|
-
# 550 - Requested action not taken: no such user here
|
93
|
-
v['diagnosis'] << ' ' << e
|
94
|
-
end
|
95
|
-
else
|
96
|
-
# Error message below:
|
97
|
-
# 550 - Requested action not taken: no such user here
|
98
|
-
v['diagnosis'] = e if e == StartingOf[:error][0]
|
99
|
-
unless gotmessage
|
100
|
-
v['diagnosis'] ||= ''
|
101
|
-
v['diagnosis'] << ' ' + e
|
102
|
-
end
|
103
|
-
end
|
80
|
+
alternates[3] = e[11, e.size]
|
81
|
+
|
82
|
+
elsif e.start_with?(" MAIL FROM: ")
|
83
|
+
# MAIL FROM: shironeko@example.jp
|
84
|
+
alternates[0] = e[13, e.size]
|
85
|
+
|
86
|
+
elsif e.start_with?(" From: ")
|
87
|
+
# From: Neko <shironeko@example.jp>
|
88
|
+
alternates[1] = e[8, e.size]
|
89
|
+
|
104
90
|
end
|
105
91
|
end
|
106
92
|
return nil unless recipients > 0
|
107
93
|
|
108
|
-
|
109
|
-
|
94
|
+
if emailparts[1].empty?
|
95
|
+
# The original message is empty
|
96
|
+
emailparts[1] << sprintf("From: %s\n", alternates[1]) if alternates[1] != ""
|
97
|
+
emailparts[1] << sprintf("Date: %s\n", alternates[2]) if alternates[2] != ""
|
98
|
+
end
|
99
|
+
if emailparts[1].include?("Return-Path: ") == false
|
100
|
+
# Set the envelope from address as a Return-Path: header
|
101
|
+
emailparts[1] << sprintf("Return-Path: <%s>\n", alternates[0]) if alternates[0] != ""
|
102
|
+
end
|
103
|
+
if emailparts[1].include?("\nSubject: ") == false
|
104
|
+
# Set the envelope from address as a Return-Path: header
|
105
|
+
emailparts[1] << sprintf("Subject: %s\n", alternates[3]) if alternates[3] != ""
|
106
|
+
end
|
110
107
|
|
111
|
-
dscontents.each { |e| e[
|
112
|
-
return {
|
108
|
+
dscontents.each { |e| e["diagnosis"] = Sisimai::String.sweep(e["diagnosis"]) }
|
109
|
+
return { "ds" => dscontents, "rfc822" => emailparts[1] }
|
113
110
|
end
|
114
111
|
def description; return 'Java Apache Mail Enterprise Server'; end
|
115
112
|
end
|
@@ -63,7 +63,7 @@ module Sisimai::Lhost
|
|
63
63
|
if e.include?('@') && e.include?(' ') == false
|
64
64
|
# ----- The following addresses had delivery problems -----
|
65
65
|
# ********@***.biglobe.ne.jp
|
66
|
-
if v[
|
66
|
+
if v["recipient"] != ""
|
67
67
|
# There are multiple recipient addresses in the message body.
|
68
68
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
69
69
|
v = dscontents[-1]
|
@@ -74,7 +74,6 @@ module Sisimai::Lhost
|
|
74
74
|
recipients += 1
|
75
75
|
else
|
76
76
|
next if e.include?('--')
|
77
|
-
v['diagnosis'] ||= ''
|
78
77
|
v['diagnosis'] << e + ' '
|
79
78
|
end
|
80
79
|
end
|
@@ -12,7 +12,6 @@ module Sisimai::Lhost
|
|
12
12
|
# courier/module.dsn/dsn*.txt
|
13
13
|
message: ['DELAYS IN DELIVERING YOUR MESSAGE', 'UNDELIVERABLE MAIL'],
|
14
14
|
}.freeze
|
15
|
-
|
16
15
|
MessagesOf = {
|
17
16
|
# courier/module.esmtp/esmtpclient.c:526| hard_error(del, ctf, "No such domain.");
|
18
17
|
'hostunknown' => ['No such domain.'],
|
@@ -39,8 +38,9 @@ module Sisimai::Lhost
|
|
39
38
|
end
|
40
39
|
return nil unless match > 0
|
41
40
|
|
42
|
-
require 'sisimai/
|
41
|
+
require 'sisimai/rfc1123'
|
43
42
|
require 'sisimai/rfc1894'
|
43
|
+
require 'sisimai/smtp/command'
|
44
44
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
45
45
|
permessage = {} # (Hash) Store values of each Per-Message field
|
46
46
|
|
@@ -68,17 +68,18 @@ module Sisimai::Lhost
|
|
68
68
|
next if (readcursor & Indicators[:deliverystatus]) == 0
|
69
69
|
next if e.empty?
|
70
70
|
|
71
|
-
|
71
|
+
f = Sisimai::RFC1894.match(e)
|
72
|
+
if f > 0
|
72
73
|
# "e" matched with any field defined in RFC3464
|
73
74
|
next unless o = Sisimai::RFC1894.field(e)
|
74
75
|
v = dscontents[-1]
|
75
76
|
|
76
|
-
if o[
|
77
|
+
if o[3] == 'addr'
|
77
78
|
# Final-Recipient: rfc822; kijitora@example.jp
|
78
79
|
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
79
80
|
if o[0] == 'final-recipient'
|
80
81
|
# Final-Recipient: rfc822; kijitora@example.jp
|
81
|
-
if v[
|
82
|
+
if v["recipient"] != ""
|
82
83
|
# There are multiple recipient addresses in the message body.
|
83
84
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
84
85
|
v = dscontents[-1]
|
@@ -89,16 +90,17 @@ module Sisimai::Lhost
|
|
89
90
|
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
90
91
|
v['alias'] = o[2]
|
91
92
|
end
|
92
|
-
elsif o[
|
93
|
+
elsif o[3] == 'code'
|
93
94
|
# Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
|
94
95
|
v['spec'] = o[1]
|
95
96
|
v['diagnosis'] = o[2]
|
96
97
|
else
|
97
98
|
# Other DSN fields defined in RFC3464
|
98
99
|
next unless fieldtable[o[0]]
|
100
|
+
next if o[3] == "host" && Sisimai::RFC1123.is_internethost(o[2]) == false
|
99
101
|
v[fieldtable[o[0]]] = o[2]
|
100
102
|
|
101
|
-
next unless f
|
103
|
+
next unless f == 1
|
102
104
|
permessage[fieldtable[o[0]]] = o[2]
|
103
105
|
end
|
104
106
|
else
|
@@ -126,7 +128,7 @@ module Sisimai::Lhost
|
|
126
128
|
dscontents.each do |e|
|
127
129
|
# Set default values if each value is empty.
|
128
130
|
permessage.each_key { |a| e[a] ||= permessage[a] || '' }
|
129
|
-
e['command']
|
131
|
+
e['command'] = thecommand if e["command"].empty?
|
130
132
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis']) || ''
|
131
133
|
|
132
134
|
MessagesOf.each_key do |r|
|
data/lib/sisimai/lhost/domino.rb
CHANGED
@@ -9,15 +9,15 @@ module Sisimai::Lhost
|
|
9
9
|
Boundaries = ['Content-Type: message/rfc822'].freeze
|
10
10
|
StartingOf = { message: ['Your message'] }.freeze
|
11
11
|
MessagesOf = {
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
"filtered" => ["Cannot route mail to user"],
|
13
|
+
"systemerror" => ["Several matches found in Domino Directory"],
|
14
|
+
"userunknown" => [
|
15
|
+
"not listed in Domino Directory",
|
16
|
+
"not listed in public Name & Address Book",
|
15
17
|
"non répertorié dans l'annuaire Domino",
|
16
|
-
|
17
|
-
|
18
|
+
"no se encuentra en el Directorio de Domino",
|
19
|
+
"Domino ディレクトリには見つかりません",
|
18
20
|
],
|
19
|
-
'filtered' => ['Cannot route mail to user'],
|
20
|
-
'systemerror' => ['Several matches found in Domino Directory'],
|
21
21
|
}.freeze
|
22
22
|
|
23
23
|
# @abstract Decodes the bounce message from HCL Domino (formerly IBM Domino Server (formerly Lotus Domino))
|
@@ -28,6 +28,7 @@ module Sisimai::Lhost
|
|
28
28
|
def inquire(mhead, mbody)
|
29
29
|
return nil unless mhead['subject'].start_with?('DELIVERY FAILURE:', 'DELIVERY_FAILURE:')
|
30
30
|
|
31
|
+
require 'sisimai/rfc1123'
|
31
32
|
require 'sisimai/rfc1894'
|
32
33
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
33
34
|
permessage = {} # (Hash) Store values of each Per-Message field
|
@@ -68,12 +69,13 @@ module Sisimai::Lhost
|
|
68
69
|
|
69
70
|
if e.start_with?('was not delivered to:')
|
70
71
|
# was not delivered to:
|
71
|
-
|
72
|
+
# kijitora@example.net
|
73
|
+
if v["recipient"] != ""
|
72
74
|
# There are multiple recipient addresses in the message body.
|
73
75
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
74
76
|
v = dscontents[-1]
|
75
77
|
end
|
76
|
-
v['recipient']
|
78
|
+
v['recipient'] = e if v["recipient"].empty?
|
77
79
|
recipients += 1
|
78
80
|
|
79
81
|
elsif e.start_with?(' ') && e.include?('@') && e.index(' ', 3).nil?
|
@@ -83,9 +85,10 @@ module Sisimai::Lhost
|
|
83
85
|
|
84
86
|
elsif e.start_with?('because:')
|
85
87
|
# because:
|
88
|
+
# User some.name (kijitora@example.net) not listed in Domino Directory
|
86
89
|
v['diagnosis'] = e
|
87
90
|
else
|
88
|
-
if v['diagnosis']
|
91
|
+
if v['diagnosis'] == "because:"
|
89
92
|
# Error message, continued from the line "because:"
|
90
93
|
v['diagnosis'] = e
|
91
94
|
|
@@ -93,28 +96,25 @@ module Sisimai::Lhost
|
|
93
96
|
# Subject: Nyaa
|
94
97
|
subjecttxt = e[11, e.size]
|
95
98
|
|
96
|
-
|
97
|
-
#
|
98
|
-
|
99
|
-
next if o
|
99
|
+
else
|
100
|
+
# Other fields defined in RFC3464
|
101
|
+
f = Sisimai::RFC1894.match(e); next if f < 1
|
102
|
+
o = Sisimai::RFC1894.field(e); next if o.nil?
|
103
|
+
next if o[3] == 'addr'
|
100
104
|
|
101
|
-
if o[
|
105
|
+
if o[3] == 'code'
|
102
106
|
# Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
|
103
|
-
v['spec'] = o[1] if v['spec'].
|
104
|
-
v['diagnosis'] = o[2] if v['diagnosis'].
|
107
|
+
v['spec'] = o[1] if v['spec'].empty?
|
108
|
+
v['diagnosis'] = o[2] if v['diagnosis'].empty?
|
105
109
|
else
|
106
110
|
# Other DSN fields defined in RFC3464
|
107
111
|
next unless fieldtable[o[0]]
|
112
|
+
next if o[3] == "host" && Sisimai::RFC1123.is_internethost(o[2]) == false
|
108
113
|
v[fieldtable[o[0]]] = o[2]
|
109
114
|
|
110
|
-
next unless f
|
115
|
+
next unless f == 1
|
111
116
|
permessage[fieldtable[o[0]]] = o[2]
|
112
117
|
end
|
113
|
-
else
|
114
|
-
if v['diagnosis'] && e.start_with?("\s", "\t")
|
115
|
-
# The line is a continued line of "Diagnostic-Code:" field
|
116
|
-
v['diagnosis'] += e.sub(/\A[\s\t]+/, '')
|
117
|
-
end
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -128,8 +128,8 @@ module Sisimai::Lhost
|
|
128
128
|
MessagesOf.each_key do |r|
|
129
129
|
# Check each regular expression of Domino error messages
|
130
130
|
next unless MessagesOf[r].any? { |a| e['diagnosis'].include?(a) }
|
131
|
-
e['reason']
|
132
|
-
e['status']
|
131
|
+
e['reason'] = r
|
132
|
+
e['status'] = Sisimai::SMTP::Status.code(r, false) if e["status"].empty?
|
133
133
|
break
|
134
134
|
end
|
135
135
|
end
|
@@ -72,7 +72,7 @@ module Sisimai::Lhost
|
|
72
72
|
if e.start_with?('There was an error delivering your mail to <')
|
73
73
|
# email.example.jp [192.0.2.25] did not like our RCPT TO:
|
74
74
|
# 552 5.2.2 <kijitora@example.com>: Recipient address rejected: Mailbox full
|
75
|
-
if v[
|
75
|
+
if v["recipient"] != ""
|
76
76
|
# There are multiple recipient addresses in the message body.
|
77
77
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
78
78
|
v = dscontents[-1]
|
@@ -81,17 +81,16 @@ module Sisimai::Lhost
|
|
81
81
|
recipients += 1
|
82
82
|
else
|
83
83
|
# Pick the error message
|
84
|
-
v['diagnosis'] ||= ''
|
85
84
|
v['diagnosis'] << ' ' << e
|
86
85
|
|
87
86
|
# Pick the remote hostname, and the SMTP command
|
88
87
|
# net.c:500| snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s",
|
89
88
|
next unless e.include?(' did not like our ')
|
90
|
-
next if v['rhost']
|
89
|
+
next if v['rhost'] != ""
|
91
90
|
|
92
91
|
p = e.split(' ', 3)
|
93
92
|
v['rhost'] = if p[0].include?('.') then p[0] else p[1] end
|
94
|
-
v['command'] = Sisimai::SMTP::Command.find(e)
|
93
|
+
v['command'] = Sisimai::SMTP::Command.find(e)
|
95
94
|
end
|
96
95
|
end
|
97
96
|
return nil unless recipients > 0
|
@@ -54,7 +54,7 @@ module Sisimai::Lhost
|
|
54
54
|
if cv = e.match(/\A\s*([^ ]+[@][^ ]+?)[:]?\z/)
|
55
55
|
# general@example.eu OR
|
56
56
|
# the line begin with 4 space characters, end with ":" like " neko@example.eu:"
|
57
|
-
if v[
|
57
|
+
if v["recipient"] != ""
|
58
58
|
# There are multiple recipient addresses in the message body.
|
59
59
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
60
60
|
v = dscontents[-1]
|
@@ -82,9 +82,8 @@ module Sisimai::Lhost
|
|
82
82
|
|
83
83
|
require 'sisimai/smtp/command'
|
84
84
|
dscontents.each do |e|
|
85
|
-
e['diagnosis']
|
86
|
-
e['
|
87
|
-
e['command'] = Sisimai::SMTP::Command.find(e['diagnosis'])
|
85
|
+
e['diagnosis'] = e['alterrors'] if e['diagnosis'].empty?
|
86
|
+
e['command'] = Sisimai::SMTP::Command.find(e['diagnosis'])
|
88
87
|
|
89
88
|
if Sisimai::String.aligned(e['diagnosis'], ['host: ', ' reason:'])
|
90
89
|
# SMTP error from remote server for TEXT command,
|
@@ -126,7 +126,7 @@ module Sisimai::Lhost
|
|
126
126
|
if Sisimai::String.aligned(e, ['@', ' on '])
|
127
127
|
# kijitora@example.co.jp on Thu, 29 Apr 2007 16:51:51 -0500
|
128
128
|
# kijitora@example.com on 4/29/99 9:19:59 AM
|
129
|
-
if v[
|
129
|
+
if v["recipient"] != ""
|
130
130
|
# There are multiple recipient addresses in the message body.
|
131
131
|
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
132
132
|
v = dscontents[-1]
|
@@ -139,11 +139,10 @@ module Sisimai::Lhost
|
|
139
139
|
|
140
140
|
elsif e.start_with?(' ') && e.include?('MSEXCH:')
|
141
141
|
# MSEXCH:IMS:KIJITORA CAT:EXAMPLE:EXCHANGE 0 (000C05A6) Unknown Recipient
|
142
|
-
v['diagnosis'] ||= ''
|
143
142
|
v['diagnosis'] << e[e.index('MSEXCH:'), e.size]
|
144
143
|
else
|
145
144
|
next if v['msexch']
|
146
|
-
if v['diagnosis'].
|
145
|
+
if v['diagnosis'].start_with?('MSEXCH:')
|
147
146
|
# Continued from MEEXCH in the previous line
|
148
147
|
v['msexch'] = true
|
149
148
|
v['diagnosis'] << ' ' << e
|
@@ -186,7 +185,7 @@ module Sisimai::Lhost
|
|
186
185
|
|
187
186
|
dscontents.each do |e|
|
188
187
|
e.delete('msexch')
|
189
|
-
|
188
|
+
|
190
189
|
if e['diagnosis'].start_with?('MSEXCH:')
|
191
190
|
# MSEXCH:IMS:KIJITORA CAT:EXAMPLE:EXCHANGE 0 (000C05A6) Unknown Recipient
|
192
191
|
p1 = e['diagnosis'].index('(') || -1
|
@@ -198,16 +197,15 @@ module Sisimai::Lhost
|
|
198
197
|
# Find captured code from the error code table
|
199
198
|
next unless ErrorCodes[r].index(capturedcode)
|
200
199
|
e['reason'] = r
|
201
|
-
e['status'] = Sisimai::SMTP::Status.code(r
|
200
|
+
e['status'] = Sisimai::SMTP::Status.code(r) || ""
|
202
201
|
break
|
203
202
|
end
|
204
203
|
e['diagnosis'] = errormessage
|
205
204
|
end
|
206
205
|
|
207
|
-
|
206
|
+
if e["reason"].empty?
|
208
207
|
# Could not detect the reason from the value of "diagnosis".
|
209
|
-
next
|
210
|
-
next if e['alterrors'].empty?
|
208
|
+
next if e["alterrors"].empty?
|
211
209
|
|
212
210
|
# Copy alternative error message
|
213
211
|
e['diagnosis'] = e['alterrors'] + ' ' + e['diagnosis']
|