sisimai 4.25.16 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/ANALYTICAL-PRECISION +2 -2
- data/Benchmarks.mk +3 -3
- data/CONTRIBUTING +1 -1
- data/ChangeLog.md +412 -393
- data/Developers.mk +5 -6
- data/Gemfile +1 -1
- data/Makefile +15 -15
- data/README-JA.md +140 -78
- data/README.md +290 -143
- data/Rakefile +9 -3
- data/Repository.mk +2 -3
- data/lib/sisimai/address.rb +118 -74
- data/lib/sisimai/arf.rb +84 -82
- data/lib/sisimai/datetime.rb +5 -52
- data/lib/sisimai/{data → fact}/json.rb +7 -9
- data/lib/sisimai/fact/yaml.rb +31 -0
- data/lib/sisimai/fact.rb +468 -0
- data/lib/sisimai/lhost/activehunter.rb +12 -14
- data/lib/sisimai/lhost/amavis.rb +11 -14
- data/lib/sisimai/lhost/amazonses.rb +37 -41
- data/lib/sisimai/lhost/amazonworkmail.rb +15 -18
- data/lib/sisimai/lhost/aol.rb +12 -14
- data/lib/sisimai/lhost/apachejames.rb +19 -21
- data/lib/sisimai/lhost/barracuda.rb +10 -12
- data/lib/sisimai/lhost/bigfoot.rb +21 -21
- data/lib/sisimai/lhost/biglobe.rb +15 -16
- data/lib/sisimai/lhost/courier.rb +20 -20
- data/lib/sisimai/lhost/domino.rb +23 -19
- data/lib/sisimai/lhost/einsundeins.rb +23 -18
- data/lib/sisimai/lhost/exchange2003.rb +30 -29
- data/lib/sisimai/lhost/exchange2007.rb +70 -58
- data/lib/sisimai/lhost/exim.rb +175 -161
- data/lib/sisimai/lhost/ezweb.rb +31 -56
- data/lib/sisimai/lhost/facebook.rb +21 -33
- data/lib/sisimai/lhost/fml.rb +43 -48
- data/lib/sisimai/lhost/gmail.rb +29 -29
- data/lib/sisimai/lhost/gmx.rb +18 -17
- data/lib/sisimai/lhost/googlegroups.rb +9 -10
- data/lib/sisimai/lhost/gsuite.rb +21 -27
- data/lib/sisimai/lhost/imailserver.rb +25 -39
- data/lib/sisimai/lhost/interscanmss.rb +28 -31
- data/lib/sisimai/lhost/kddi.rb +22 -28
- data/lib/sisimai/lhost/mailfoundry.rb +11 -12
- data/lib/sisimai/lhost/mailmarshalsmtp.rb +25 -29
- data/lib/sisimai/lhost/mailru.rb +33 -27
- data/lib/sisimai/lhost/mcafee.rb +21 -31
- data/lib/sisimai/lhost/messagelabs.rb +17 -20
- data/lib/sisimai/lhost/messagingserver.rb +40 -37
- data/lib/sisimai/lhost/mfilter.rb +15 -16
- data/lib/sisimai/lhost/mxlogic.rb +24 -23
- data/lib/sisimai/lhost/notes.rb +17 -17
- data/lib/sisimai/lhost/office365.rb +63 -27
- data/lib/sisimai/lhost/opensmtpd.rb +12 -13
- data/lib/sisimai/lhost/outlook.rb +12 -15
- data/lib/sisimai/lhost/postfix.rb +179 -129
- data/lib/sisimai/lhost/powermta.rb +12 -14
- data/lib/sisimai/lhost/qmail.rb +44 -47
- data/lib/sisimai/lhost/receivingses.rb +15 -20
- data/lib/sisimai/lhost/sendgrid.rb +34 -32
- data/lib/sisimai/lhost/sendmail.rb +66 -53
- data/lib/sisimai/lhost/surfcontrol.rb +19 -19
- data/lib/sisimai/lhost/v5sendmail.rb +45 -39
- data/lib/sisimai/lhost/verizon.rb +35 -39
- data/lib/sisimai/lhost/x1.rb +18 -17
- data/lib/sisimai/lhost/x2.rb +17 -14
- data/lib/sisimai/lhost/x3.rb +19 -19
- data/lib/sisimai/lhost/x4.rb +72 -57
- data/lib/sisimai/lhost/x5.rb +17 -19
- data/lib/sisimai/lhost/x6.rb +41 -17
- data/lib/sisimai/lhost/yahoo.rb +17 -16
- data/lib/sisimai/lhost/yandex.rb +16 -20
- data/lib/sisimai/lhost/zoho.rb +16 -15
- data/lib/sisimai/lhost.rb +8 -10
- data/lib/sisimai/mail/maildir.rb +1 -3
- data/lib/sisimai/mail/mbox.rb +3 -4
- data/lib/sisimai/mail/memory.rb +0 -1
- data/lib/sisimai/mail/stdin.rb +1 -3
- data/lib/sisimai/mail.rb +3 -7
- data/lib/sisimai/mda.rb +28 -42
- data/lib/sisimai/message.rb +435 -326
- data/lib/sisimai/order.rb +5 -5
- data/lib/sisimai/reason/authfailure.rb +64 -0
- data/lib/sisimai/reason/badreputation.rb +53 -0
- data/lib/sisimai/reason/blocked.rb +94 -160
- data/lib/sisimai/reason/contenterror.rb +8 -9
- data/lib/sisimai/reason/delivered.rb +4 -6
- data/lib/sisimai/reason/exceedlimit.rb +10 -12
- data/lib/sisimai/reason/expired.rb +6 -8
- data/lib/sisimai/reason/feedback.rb +2 -3
- data/lib/sisimai/reason/filtered.rb +17 -19
- data/lib/sisimai/reason/hasmoved.rb +9 -10
- data/lib/sisimai/reason/hostunknown.rb +15 -15
- data/lib/sisimai/reason/mailboxfull.rb +10 -12
- data/lib/sisimai/reason/mailererror.rb +18 -20
- data/lib/sisimai/reason/mesgtoobig.rb +9 -11
- data/lib/sisimai/reason/networkerror.rb +5 -8
- data/lib/sisimai/reason/norelaying.rb +8 -11
- data/lib/sisimai/reason/notaccept.rb +13 -14
- data/lib/sisimai/reason/notcompliantrfc.rb +43 -0
- data/lib/sisimai/reason/onhold.rb +6 -9
- data/lib/sisimai/reason/policyviolation.rb +14 -12
- data/lib/sisimai/reason/rejected.rb +26 -24
- data/lib/sisimai/reason/requireptr.rb +69 -0
- data/lib/sisimai/reason/securityerror.rb +33 -36
- data/lib/sisimai/reason/spamdetected.rb +114 -147
- data/lib/sisimai/reason/speeding.rb +49 -0
- data/lib/sisimai/reason/suspend.rb +11 -11
- data/lib/sisimai/reason/syntaxerror.rb +11 -10
- data/lib/sisimai/reason/systemerror.rb +7 -9
- data/lib/sisimai/reason/systemfull.rb +7 -8
- data/lib/sisimai/reason/toomanyconn.rb +9 -11
- data/lib/sisimai/reason/undefined.rb +2 -3
- data/lib/sisimai/reason/userunknown.rb +129 -146
- data/lib/sisimai/reason/vacation.rb +3 -4
- data/lib/sisimai/reason/virusdetected.rb +10 -11
- data/lib/sisimai/reason.rb +59 -64
- data/lib/sisimai/rfc1894.rb +55 -28
- data/lib/sisimai/rfc2045.rb +373 -0
- data/lib/sisimai/rfc3464.rb +250 -308
- data/lib/sisimai/rfc3834.rb +42 -45
- data/lib/sisimai/rfc5322.rb +75 -100
- data/lib/sisimai/rfc5965.rb +31 -0
- data/lib/sisimai/rhost/cox.rb +5 -6
- data/lib/sisimai/rhost/franceptt.rb +6 -8
- data/lib/sisimai/rhost/godaddy.rb +12 -12
- data/lib/sisimai/rhost/{googleapps.rb → google.rb} +80 -72
- data/lib/sisimai/rhost/iua.rb +9 -10
- data/lib/sisimai/rhost/kddi.rb +6 -8
- data/lib/sisimai/rhost/{exchangeonline.rb → microsoft.rb} +115 -114
- data/lib/sisimai/rhost/mimecast.rb +42 -40
- data/lib/sisimai/rhost/nttdocomo.rb +12 -12
- data/lib/sisimai/rhost/spectrum.rb +10 -12
- data/lib/sisimai/rhost/{tencentqq.rb → tencent.rb} +7 -8
- data/lib/sisimai/rhost.rb +23 -31
- data/lib/sisimai/smtp/command.rb +59 -0
- data/lib/sisimai/smtp/error.rb +4 -7
- data/lib/sisimai/smtp/reply.rb +161 -74
- data/lib/sisimai/smtp/status.rb +504 -393
- data/lib/sisimai/smtp/transcript.rb +124 -0
- data/lib/sisimai/smtp.rb +0 -1
- data/lib/sisimai/string.rb +74 -5
- data/lib/sisimai/time.rb +1 -2
- data/lib/sisimai/version.rb +1 -1
- data/lib/sisimai.rb +35 -21
- data/set-of-emails/maildir/bsd/lhost-domino-02.eml +6 -3
- data/set-of-emails/maildir/bsd/lhost-googlegroups-15.eml +174 -0
- data/set-of-emails/maildir/bsd/lhost-gsuite-15.eml +229 -0
- data/set-of-emails/maildir/bsd/lhost-postfix-75.eml +51 -0
- data/set-of-emails/maildir/bsd/lhost-postfix-76.eml +101 -0
- data/set-of-emails/maildir/bsd/lhost-postfix-77.eml +74 -0
- data/set-of-emails/maildir/bsd/lhost-postfix-78.eml +91 -0
- data/set-of-emails/maildir/bsd/lhost-receivingses-08.eml +88 -0
- data/set-of-emails/maildir/bsd/rfc3464-43.eml +88 -0
- data/set-of-emails/maildir/bsd/rhost-google-03.eml +101 -0
- data/set-of-emails/maildir/bsd/rhost-google-04.eml +102 -0
- data/set-of-emails/maildir/bsd/rhost-google-05.eml +82 -0
- data/set-of-emails/maildir/bsd/rhost-google-06.eml +102 -0
- data/set-of-emails/maildir/bsd/rhost-google-07.eml +69 -0
- data/set-of-emails/maildir/bsd/rhost-google-08.eml +99 -0
- data/sisimai-java.gemspec +1 -1
- data/sisimai.gemspec +1 -1
- metadata +41 -20
- data/.rspec +0 -2
- data/lib/sisimai/data/yaml.rb +0 -33
- data/lib/sisimai/data.rb +0 -411
- data/lib/sisimai/mime.rb +0 -456
- /data/set-of-emails/maildir/bsd/{rfc3464-41.eml → rfc3834-05.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-googleapps-01.eml → rhost-google-01.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-googleapps-02.eml → rhost-google-02.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-01.eml → rhost-microsoft-01.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-02.eml → rhost-microsoft-02.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-03.eml → rhost-microsoft-03.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-tencentqq-01.eml → rhost-tencent-01.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-tencentqq-02.eml → rhost-tencent-02.eml} +0 -0
- /data/set-of-emails/maildir/bsd/{rhost-tencentqq-03.eml → rhost-tencent-03.eml} +0 -0
@@ -1,16 +1,13 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::Filtered checks the bounce reason is "filtered" or not.
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::Filtered checks the bounce reason is "filtered" or not. This class is called
|
4
|
+
# only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that an email has been rejected by a header content after
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# set "filtered" to the reason of email bounce if the value of Status: field
|
11
|
-
# in a bounce email is "5.2.0" or "5.2.1".
|
6
|
+
# This is the error that an email has been rejected by a header content after SMTP DATA command.
|
7
|
+
# In Japanese cellular phones, the error will incur that a sender's email address or a domain
|
8
|
+
# is rejected by recipient's email configuration. Sisimai will set "filtered" to the reason of
|
9
|
+
# email bounce if the value of Status: field in a bounce email is "5.2.0" or "5.2.1".
|
12
10
|
module Filtered
|
13
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/Filtered.pm
|
14
11
|
class << self
|
15
12
|
Index = [
|
16
13
|
'because the recipient is only accepting mail from specific email addresses', # AOL Phoenix
|
@@ -27,7 +24,7 @@ module Sisimai
|
|
27
24
|
'user reject',
|
28
25
|
'we failed to deliver mail because the following address recipient id refuse to receive mail', # Willcom
|
29
26
|
'you have been blocked by the recipient',
|
30
|
-
]
|
27
|
+
].freeze
|
31
28
|
|
32
29
|
def text; return 'filtered'; end
|
33
30
|
def description; return 'Email rejected due to a header content after SMTP DATA command'; end
|
@@ -43,29 +40,30 @@ module Sisimai
|
|
43
40
|
end
|
44
41
|
|
45
42
|
# Rejected by a sender domain or a sender address by a filter ?
|
46
|
-
# @param [Sisimai::
|
43
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
47
44
|
# @return [True,False] true: is filtered
|
48
45
|
# false: is not filtered
|
49
46
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
50
47
|
def true(argvs)
|
51
|
-
return true if argvs
|
48
|
+
return true if argvs['reason'] == 'filtered'
|
52
49
|
|
53
50
|
require 'sisimai/reason/userunknown'
|
54
|
-
tempreason = Sisimai::SMTP::Status.name(argvs
|
51
|
+
tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus']) || ''
|
55
52
|
return false if tempreason == 'suspend'
|
56
53
|
|
57
|
-
|
54
|
+
issuedcode = argvs['diagnosticcode'].downcase || ''
|
55
|
+
thecommand = argvs['smtpcommand'] || ''
|
58
56
|
if tempreason == 'filtered'
|
59
57
|
# Delivery status code points "filtered".
|
60
|
-
return true if Sisimai::Reason::UserUnknown.match(
|
61
|
-
return true if match(
|
58
|
+
return true if Sisimai::Reason::UserUnknown.match(issuedcode)
|
59
|
+
return true if match(issuedcode)
|
62
60
|
else
|
63
61
|
# The value of "reason" isn't "filtered" when the value of "smtpcommand" is an SMTP
|
64
62
|
# command to be sent before the SMTP DATA command because all the MTAs read the headers
|
65
63
|
# and the entire message body after the DATA command.
|
66
|
-
return false if %w[CONN EHLO HELO MAIL RCPT].include?(
|
67
|
-
return true if match(
|
68
|
-
return true if Sisimai::Reason::UserUnknown.match(
|
64
|
+
return false if %w[CONN EHLO HELO MAIL RCPT].include?(thecommand)
|
65
|
+
return true if match(issuedcode)
|
66
|
+
return true if Sisimai::Reason::UserUnknown.match(issuedcode)
|
69
67
|
end
|
70
68
|
return false
|
71
69
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::HasMoved checks the bounce reason is "hasmoved" or not.
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::HasMoved checks the bounce reason is "hasmoved" or not. This class is called
|
4
|
+
# only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a user's mailbox has moved (and is not forwarded
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# This is the error that a user's mailbox has moved (and is not forwarded automatically). Sisimai
|
7
|
+
# will set "hasmoved" to the reason of email bounce if the value of Status: field in a bounce email
|
8
|
+
# is "5.1.6".
|
9
9
|
module HasMoved
|
10
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/HasMoved.pm
|
11
10
|
class << self
|
12
|
-
Index = [' has been replaced by ']
|
11
|
+
Index = [' has been replaced by '].freeze
|
13
12
|
|
14
13
|
def text; return 'hasmoved'; end
|
15
14
|
def description; return "Email rejected due to user's mailbox has moved and is not forwarded automatically"; end
|
@@ -25,13 +24,13 @@ module Sisimai
|
|
25
24
|
end
|
26
25
|
|
27
26
|
# Whether the address has moved or not
|
28
|
-
# @param [Sisimai::
|
27
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
29
28
|
# @return [True,False] true: The address has moved
|
30
29
|
# false: Has not moved
|
31
30
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
32
31
|
def true(argvs)
|
33
|
-
return true if argvs
|
34
|
-
return true if match(argvs
|
32
|
+
return true if argvs['reason'] == 'hasmoved'
|
33
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
35
34
|
return false
|
36
35
|
end
|
37
36
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# This is the error that a domain part ( Right hand side of @ sign ) of a
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# of Status: field in a bounce mail is "5.1.2".
|
3
|
+
# This is the error that a domain part ( Right hand side of @ sign ) of a recipient's email
|
4
|
+
# address does not exist. In many case, the domain part is misspelled, or the domain name has
|
5
|
+
# been expired. Sisimai will set "hostunknown" to the reason of email bounce if the value of
|
6
|
+
# Status: field in a bounce mail is "5.1.2".
|
8
7
|
module HostUnknown
|
9
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/HostUnknown.pm
|
10
8
|
class << self
|
9
|
+
require 'sisimai/string'
|
10
|
+
|
11
11
|
Index = [
|
12
12
|
'domain does not exist',
|
13
13
|
'domain is not reachable',
|
@@ -24,8 +24,8 @@ module Sisimai
|
|
24
24
|
'unknown host',
|
25
25
|
'unroutable address',
|
26
26
|
'unrouteable address',
|
27
|
-
]
|
28
|
-
|
27
|
+
].freeze
|
28
|
+
Pairs = [['553 ', ' does not exist']].freeze
|
29
29
|
|
30
30
|
def text; return 'hostunknown'; end
|
31
31
|
def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
|
@@ -38,29 +38,29 @@ module Sisimai
|
|
38
38
|
def match(argv1)
|
39
39
|
return nil unless argv1
|
40
40
|
return true if Index.any? { |a| argv1.include?(a) }
|
41
|
-
return true if argv1
|
41
|
+
return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
|
42
42
|
return false
|
43
43
|
end
|
44
44
|
|
45
45
|
# Whether the host is unknown or not
|
46
|
-
# @param [Sisimai::
|
46
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
47
47
|
# @return [True,False] true: is unknown host
|
48
48
|
# false: is not unknown host.
|
49
49
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
50
50
|
def true(argvs)
|
51
|
-
return true if argvs
|
51
|
+
return true if argvs['reason'] == 'hostunknown'
|
52
52
|
|
53
|
-
|
54
|
-
statuscode = argvs
|
53
|
+
issuedcode = argvs['diagnosticcode'].downcase || ''
|
54
|
+
statuscode = argvs['deliverystatus'] || ''
|
55
55
|
|
56
56
|
if Sisimai::SMTP::Status.name(statuscode).to_s == 'hostunknown'
|
57
57
|
# Status: 5.1.2
|
58
58
|
# Diagnostic-Code: SMTP; 550 Host unknown
|
59
59
|
require 'sisimai/reason/networkerror'
|
60
|
-
return true unless Sisimai::Reason::NetworkError.match(
|
60
|
+
return true unless Sisimai::Reason::NetworkError.match(issuedcode)
|
61
61
|
else
|
62
62
|
# Check the value of Diagnosic-Code: header with patterns
|
63
|
-
return true if match(
|
63
|
+
return true if match(issuedcode)
|
64
64
|
end
|
65
65
|
|
66
66
|
return false
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::MailboxFull checks the bounce reason is "mailboxfull" or
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::MailboxFull checks the bounce reason is "mailboxfull" or not. This class is
|
4
|
+
# called only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a recipient's mailbox is full. Sisimai will set
|
7
|
-
#
|
8
|
-
# in a bounce email is "4.2.2" or "5.2.2".
|
6
|
+
# This is the error that a recipient's mailbox is full. Sisimai will set "mailboxfull" to the
|
7
|
+
# reason of email bounce if the value of Status: field in a bounce email is "4.2.2" or "5.2.2".
|
9
8
|
module MailboxFull
|
10
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/MailboxFull.pm
|
11
9
|
class << self
|
12
10
|
Index = [
|
13
11
|
'account disabled temporarly for exceeding receiving limits',
|
@@ -54,7 +52,7 @@ module Sisimai
|
|
54
52
|
'user over quota. (#5.1.1)', # qmail-toaster
|
55
53
|
'was automatically rejected: quota exceeded',
|
56
54
|
'would be over the allowed quota',
|
57
|
-
]
|
55
|
+
].freeze
|
58
56
|
|
59
57
|
def text; return 'mailboxfull'; end
|
60
58
|
def description; return "Email rejected due to a recipient's mailbox is full"; end
|
@@ -70,21 +68,21 @@ module Sisimai
|
|
70
68
|
end
|
71
69
|
|
72
70
|
# The envelope recipient's mailbox is full or not
|
73
|
-
# @param [Sisimai::
|
71
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
74
72
|
# @return [True,False] true: is mailbox full
|
75
73
|
# false: is not mailbox full
|
76
74
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
77
75
|
def true(argvs)
|
78
|
-
return nil if argvs
|
79
|
-
return true if argvs
|
76
|
+
return nil if argvs['deliverystatus'].empty?
|
77
|
+
return true if argvs['reason'] == 'mailboxfull'
|
80
78
|
|
81
79
|
# Delivery status code points "mailboxfull".
|
82
80
|
# Status: 4.2.2
|
83
81
|
# Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
|
84
|
-
return true if Sisimai::SMTP::Status.name(argvs
|
82
|
+
return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'mailboxfull'
|
85
83
|
|
86
84
|
# Check the value of Diagnosic-Code: header with patterns
|
87
|
-
return true if match(argvs
|
85
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
88
86
|
return false
|
89
87
|
end
|
90
88
|
|
@@ -1,30 +1,27 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::MailerError checks the bounce reason is "mailererror" or not.
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::MailerError checks the bounce reason is "mailererror" or not. This class is
|
4
|
+
# called only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a mailer program has not exited successfully or exited
|
7
|
-
#
|
6
|
+
# This is the error that a mailer program has not exited successfully or exited unexpectedly on
|
7
|
+
# a destination mail server.
|
8
8
|
#
|
9
9
|
# X-Actual-Recipient: X-Unix; |/home/kijitora/mail/catch.php
|
10
10
|
# Diagnostic-Code: X-Unix; 255
|
11
11
|
module MailerError
|
12
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/MailerError.pm
|
13
12
|
class << self
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
)
|
27
|
-
}x
|
13
|
+
Index = [
|
14
|
+
'procmail: ',
|
15
|
+
'bin/procmail',
|
16
|
+
'bin/maidrop',
|
17
|
+
'command failed: ',
|
18
|
+
'command died with status ',
|
19
|
+
'command output:',
|
20
|
+
'mailer error',
|
21
|
+
'pipe to |/',
|
22
|
+
'x-unix; ',
|
23
|
+
].freeze
|
24
|
+
Regex = %r/exit[ ]\d+/.freeze
|
28
25
|
|
29
26
|
def text; return 'mailererror'; end
|
30
27
|
def description; return 'Email returned due to a mailer program has not exited successfully'; end
|
@@ -35,12 +32,13 @@ module Sisimai
|
|
35
32
|
# true: Matched
|
36
33
|
def match(argv1)
|
37
34
|
return nil unless argv1
|
35
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
38
36
|
return true if argv1 =~ Regex
|
39
37
|
return false
|
40
38
|
end
|
41
39
|
|
42
40
|
# The bounce reason is mailer error or not
|
43
|
-
# @param [Sisimai::
|
41
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
44
42
|
# @return [True,False] true: is mailer error
|
45
43
|
# false: is not mailer error
|
46
44
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# This is the error that a sent email size is too big for a destination mail
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# of Status: field in a bounce email is "5.3.4".
|
3
|
+
# This is the error that a sent email size is too big for a destination mail server. In many
|
4
|
+
# case, There are many attachment files with email, or the file size is too large. Sisimai will
|
5
|
+
# set "mesgtoobig" to the reason of email bounce if the value of Status: field in a bounce email
|
6
|
+
# is "5.3.4".
|
8
7
|
module MesgTooBig
|
9
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/MesgTooBig.pm
|
10
8
|
class << self
|
11
9
|
Index = [
|
12
10
|
'exceeded maximum inbound message size',
|
@@ -21,7 +19,7 @@ module Sisimai
|
|
21
19
|
'message too large for this ',
|
22
20
|
'size limit',
|
23
21
|
'taille limite du message atteinte',
|
24
|
-
]
|
22
|
+
].freeze
|
25
23
|
|
26
24
|
def text; return 'mesgtoobig'; end
|
27
25
|
def description; return 'Email rejected due to an email size is too big for a destination mail server'; end
|
@@ -37,14 +35,14 @@ module Sisimai
|
|
37
35
|
end
|
38
36
|
|
39
37
|
# The message size is too big for the remote host
|
40
|
-
# @param [Sisimai::
|
38
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
41
39
|
# @return [True,False] true: is too big message size
|
42
40
|
# false: is not big
|
43
41
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
44
42
|
def true(argvs)
|
45
|
-
return true if argvs
|
43
|
+
return true if argvs['reason'] == 'mesgtoobig'
|
46
44
|
|
47
|
-
statuscode = argvs
|
45
|
+
statuscode = argvs['deliverystatus'] || ''
|
48
46
|
tempreason = Sisimai::SMTP::Status.name(statuscode) || ''
|
49
47
|
|
50
48
|
# Delivery status code points "mesgtoobig".
|
@@ -56,7 +54,7 @@ module Sisimai
|
|
56
54
|
return false if( tempreason == 'exceedlimit' || statuscode == '5.2.3' )
|
57
55
|
|
58
56
|
# Check the value of Diagnosic-Code: header with patterns
|
59
|
-
return true if match(argvs
|
57
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
60
58
|
return false
|
61
59
|
end
|
62
60
|
|
@@ -1,17 +1,14 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::NetworkError checks the bounce reason is "networkerror"
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::NetworkError checks the bounce reason is "networkerror" or not. This class is
|
4
|
+
# called only Sisimai::Reason class. This is the error that SMTP connection failed due to DNS
|
5
|
+
# look up failure or other network problems.
|
5
6
|
#
|
6
|
-
# This is the error that SMTP connection failed due to DNS look up failure
|
7
|
-
# or other network problems. This reason has added in Sisimai 4.1.12 and does
|
8
|
-
# not exist in any version of bounceHammer.
|
9
7
|
# A message is delayed for more than 10 minutes for the following
|
10
8
|
# list of recipients:
|
11
9
|
#
|
12
10
|
# kijitora@neko.example.jp: Network error on destination MXs
|
13
11
|
module NetworkError
|
14
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/NetworkError.pm
|
15
12
|
class << self
|
16
13
|
Index = [
|
17
14
|
'could not connect and send the mail to',
|
@@ -30,7 +27,7 @@ module Sisimai
|
|
30
27
|
'too many hops',
|
31
28
|
'unable to resolve route ',
|
32
29
|
'unrouteable mail domain',
|
33
|
-
]
|
30
|
+
].freeze
|
34
31
|
|
35
32
|
def text; return 'networkerror'; end
|
36
33
|
def description; return 'SMTP connection failed due to DNS look up failure or other network problems'; end
|
@@ -46,7 +43,7 @@ module Sisimai
|
|
46
43
|
end
|
47
44
|
|
48
45
|
# The bounce reason is network error or not
|
49
|
-
# @param [Sisimai::
|
46
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
50
47
|
# @return [True,False] true: is network error
|
51
48
|
# false: is not network error
|
52
49
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
@@ -1,20 +1,17 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::NoRelaying checks the bounce reason is "norelaying" or not.
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# This is the error that SMTP connection rejected with error message "Relaying
|
7
|
-
# Denied". This reason does not exist in any version of bounceHammer.
|
3
|
+
# Sisimai::Reason::NoRelaying checks the bounce reason is "norelaying" or not. This class is
|
4
|
+
# called only Sisimai::Reason class.
|
8
5
|
#
|
9
6
|
# ... while talking to mailin-01.mx.example.com.:
|
10
7
|
# >>> RCPT To:<kijitora@example.org>
|
11
8
|
# <<< 554 5.7.1 <kijitora@example.org>: Relay access denied
|
12
9
|
# 554 5.0.0 Service unavailable
|
13
10
|
module NoRelaying
|
14
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/NoRelaying.pm
|
15
11
|
class << self
|
16
12
|
Index = [
|
17
13
|
'as a relay',
|
14
|
+
'email address is not verified.',
|
18
15
|
'insecure mail relay',
|
19
16
|
'is not permitted to relay through this server without authentication',
|
20
17
|
'mail server requires authentication when attempting to send to a non-local e-mail address', # MailEnable
|
@@ -31,7 +28,7 @@ module Sisimai
|
|
31
28
|
'this system is not configured to relay mail',
|
32
29
|
'unable to relay for',
|
33
30
|
"we don't handle mail for",
|
34
|
-
]
|
31
|
+
].freeze
|
35
32
|
|
36
33
|
def text; return 'norelaying'; end
|
37
34
|
def description; return 'Email rejected with error message "Relaying Denied"'; end
|
@@ -47,15 +44,15 @@ module Sisimai
|
|
47
44
|
end
|
48
45
|
|
49
46
|
# Whether the message is rejected by 'Relaying denied'
|
50
|
-
# @param [Sisimai::
|
47
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
51
48
|
# @return [True,False] true: Rejected for "relaying denied"
|
52
49
|
# false: is not
|
53
50
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
54
51
|
def true(argvs)
|
55
|
-
r = argvs
|
52
|
+
r = argvs['reason'] || ''
|
56
53
|
return false if r.start_with?('securityerror', 'systemerror', 'undefined')
|
57
|
-
return false if %w[CONN EHLO HELO].include?(argvs
|
58
|
-
return true if match(argvs
|
54
|
+
return false if %w[CONN EHLO HELO].include?(argvs['smtpcommand'])
|
55
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
59
56
|
return false
|
60
57
|
end
|
61
58
|
|
@@ -1,26 +1,25 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::NotAccept checks the bounce reason is "notaccept" or not.
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::NotAccept checks the bounce reason is "notaccept" or not. This class is
|
4
|
+
# called only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a destination mail server does ( or can ) not accept
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# is 556.
|
6
|
+
# This is the error that a destination mail server does ( or can ) not accept any email. In
|
7
|
+
# many case, the server is high load or under the maintenance. Sisimai will set "notaccept" to
|
8
|
+
# the reason of email bounce if the value of Status: field in a bounce email is "5.3.2" or the
|
9
|
+
# value of SMTP reply code is 556.
|
11
10
|
module NotAccept
|
12
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/NotAccept.pm
|
13
11
|
class << self
|
14
12
|
# Destination mail server does not accept any message
|
15
13
|
Index = [
|
16
14
|
'does not accept mail (nullmx)',
|
17
15
|
'host/domain does not accept mail', # iCloud
|
18
16
|
'host does not accept mail', # Sendmail
|
17
|
+
'mail receiving disabled',
|
19
18
|
'name server: .: host not found', # Sendmail
|
20
19
|
'no mx record found for domain=', # Oath(Yahoo!)
|
21
20
|
'no route for current request',
|
22
21
|
'smtp protocol returned a permanent error',
|
23
|
-
]
|
22
|
+
].freeze
|
24
23
|
|
25
24
|
def text; return 'notaccept'; end
|
26
25
|
def description; return 'Delivery failed due to a destination mail server does not accept any email'; end
|
@@ -36,17 +35,17 @@ module Sisimai
|
|
36
35
|
end
|
37
36
|
|
38
37
|
# Remote host does not accept any message
|
39
|
-
# @param [Sisimai::
|
38
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
40
39
|
# @return [True,False] true: Not accept
|
41
40
|
# false: Accept
|
42
41
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
43
42
|
def true(argvs)
|
44
|
-
return true if argvs
|
43
|
+
return true if argvs['reason'] == 'notaccept'
|
45
44
|
|
46
45
|
# SMTP Reply Code is 554 or 556
|
47
|
-
return true if [521, 554, 556].index(argvs
|
48
|
-
return false if argvs
|
49
|
-
return true if match(argvs
|
46
|
+
return true if [521, 554, 556].index(argvs['replycode'].to_i)
|
47
|
+
return false if argvs['smtpcommand'] != 'MAIL'
|
48
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
50
49
|
return false
|
51
50
|
end
|
52
51
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Reason
|
3
|
+
# Sisimai::Reason::NotCompliantRFC checks the bounce reason is "notcompliantrfc" or not. This
|
4
|
+
# class is called only from Sisimai::Reason class.
|
5
|
+
#
|
6
|
+
# This is the error that an email is not compliant RFC 5322 or other email related RFCs. For
|
7
|
+
# example, there are multiple "Subject" headers in the email.
|
8
|
+
module NotCompliantRFC
|
9
|
+
class << self
|
10
|
+
Index = [
|
11
|
+
'this message is not rfc 5322 compliant',
|
12
|
+
'https://support.google.com/mail/?p=rfcmessagenoncompliant',
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
def text; return 'notcompliantrfc'; end
|
16
|
+
def description; return 'Email rejected due to non-compliance with RFC'; end
|
17
|
+
|
18
|
+
# Try to match that the given text and regular expressions
|
19
|
+
# @param [String] argv1 String to be matched with regular expressions
|
20
|
+
# @return [True,False] false: Did not match
|
21
|
+
# true: Matched
|
22
|
+
def match(argv1)
|
23
|
+
return nil unless argv1
|
24
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
25
|
+
return false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Whether the email is RFC compliant or not
|
29
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
30
|
+
# @return [True,False] true: RFC comliant
|
31
|
+
# false: Is not RFC compliant
|
32
|
+
# @see http://www.ietf.org/rfc/rfc5322.txt
|
33
|
+
def true(argvs)
|
34
|
+
return true if argvs['reason'] == 'notcompliantrfc'
|
35
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
36
|
+
return false
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::OnHold checks the bounce reason is "onhold" or not. This
|
4
|
-
# class
|
5
|
-
#
|
6
|
-
# Sisimai will set C<onhold> to the reason of email bounce if there is no
|
3
|
+
# Sisimai::Reason::OnHold checks the bounce reason is "onhold" or not. This class is called only
|
4
|
+
# Sisimai::Reason class. Sisimai will set "onhold" to the reason of email bounce if there is no
|
7
5
|
# (or less) detailed information about email bounce for judging the reason.
|
8
6
|
module OnHold
|
9
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/OnHold.pm
|
10
7
|
class << self
|
11
8
|
def text; return 'onhold'; end
|
12
9
|
def description; return 'Sisimai could not decided the reason due to there is no (or less) detailed information for judging the reason'; end
|
@@ -20,14 +17,14 @@ module Sisimai
|
|
20
17
|
end
|
21
18
|
|
22
19
|
# On hold, Could not decide the bounce reason...
|
23
|
-
# @param [Sisimai::
|
20
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
24
21
|
# @return [True,False] true: Status code is "onhold"
|
25
22
|
# false: is not "onhold"
|
26
23
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
27
24
|
def true(argvs)
|
28
|
-
return nil if argvs
|
29
|
-
return true if argvs
|
30
|
-
return true if Sisimai::SMTP::Status.name(argvs
|
25
|
+
return nil if argvs['deliverystatus'].empty?
|
26
|
+
return true if argvs['reason'] == 'onhold'
|
27
|
+
return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'onhold'
|
31
28
|
return false
|
32
29
|
end
|
33
30
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::PolicyViolation checks the bounce reason is "policyviolation"
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::PolicyViolation checks the bounce reason is "policyviolation" or not. This class
|
4
|
+
# is called only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a policy violation was detected on a destination mail
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# will set "policyviolation".
|
6
|
+
# This is the error that a policy violation was detected on a destination mail host. When a header
|
7
|
+
# content or a format of the original message violates security policies, or multiple addresses
|
8
|
+
# exist in the From: header, Sisimai will set "policyviolation".
|
10
9
|
#
|
11
10
|
# Status: 5.7.0
|
12
11
|
# Remote-MTA: DNS; gmail-smtp-in.l.google.com
|
@@ -14,15 +13,15 @@ module Sisimai
|
|
14
13
|
# Last-Attempt-Date: Tue, 28 Apr 2009 11:02:45 +0900 (JST)
|
15
14
|
#
|
16
15
|
module PolicyViolation
|
17
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/PolicyViolation.pm
|
18
16
|
class << self
|
17
|
+
require 'sisimai/string'
|
18
|
+
|
19
19
|
Index = [
|
20
20
|
'an illegal attachment on your message',
|
21
21
|
'because the recipient is not accepting mail with ', # AOL Phoenix
|
22
22
|
'by non-member to a members-only list',
|
23
23
|
'closed mailing list',
|
24
24
|
'denied by policy',
|
25
|
-
'dmarc policy',
|
26
25
|
'email not accepted for policy reasons',
|
27
26
|
# http://kb.mimecast.com/Mimecast_Knowledge_Base/Administration_Console/Monitoring/Mimecast_SMTP_Error_Codes#554
|
28
27
|
'email rejected due to security policies',
|
@@ -40,9 +39,11 @@ module Sisimai
|
|
40
39
|
'the message was rejected by organization policy',
|
41
40
|
'this message was blocked because its content presents a potential',
|
42
41
|
'we do not accept messages containing images or other attachments',
|
43
|
-
'
|
44
|
-
|
45
|
-
|
42
|
+
"you're using a mass mailer",
|
43
|
+
].freeze
|
44
|
+
Pairs = [
|
45
|
+
['you have exceeded the', 'allowable number of posts without solving a captcha'],
|
46
|
+
].freeze
|
46
47
|
|
47
48
|
def text; return 'policyviolation'; end
|
48
49
|
def description; return 'Email rejected due to policy violation on a destination host'; end
|
@@ -55,11 +56,12 @@ module Sisimai
|
|
55
56
|
def match(argv1)
|
56
57
|
return nil unless argv1
|
57
58
|
return true if Index.any? { |a| argv1.include?(a) }
|
59
|
+
return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
|
58
60
|
return false
|
59
61
|
end
|
60
62
|
|
61
63
|
# The bounce reason is "policyviolation" or not
|
62
|
-
# @param [Sisimai::
|
64
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
63
65
|
# @return [True,False] true: is policy violation
|
64
66
|
# false: is not policy violation
|
65
67
|
# @since 4.22.0
|