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,25 +1,23 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::Rejected checks the bounce reason is "rejected" or not.
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::Rejected checks the bounce reason is "rejected" or not. This class is called
|
4
|
+
# only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a connection to destination server was rejected by
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# MAIL command.
|
6
|
+
# This is the error that a connection to destination server was rejected by a sender's email
|
7
|
+
# address (envelope from). Sisimai set "rejected" to the reason of email bounce if the value of
|
8
|
+
# Status: field in a bounce email is "5.1.8" or the connection has been rejected due to the
|
9
|
+
# argument of SMTP MAIL command.
|
11
10
|
#
|
12
11
|
# <kijitora@example.org>:
|
13
12
|
# Connected to 192.0.2.225 but sender was rejected.
|
14
13
|
# Remote host said: 550 5.7.1 <root@nijo.example.jp>... Access denied
|
15
14
|
module Rejected
|
16
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/Rejected.pm
|
17
15
|
class << self
|
18
16
|
IsNot = [
|
19
17
|
'5.1.0 address rejected',
|
20
18
|
'recipient address rejected',
|
21
19
|
'sender ip address rejected',
|
22
|
-
]
|
20
|
+
].freeze
|
23
21
|
Index = [
|
24
22
|
'access denied (in reply to mail from command)',
|
25
23
|
'access denied (sender blacklisted)',
|
@@ -30,6 +28,7 @@ module Sisimai
|
|
30
28
|
'backscatter protection detected an invalid or expired email address', # MDaemon
|
31
29
|
"because the sender isn't on the recipient's list of senders to accept mail from",
|
32
30
|
'bogus mail from', # IMail - block empty sender
|
31
|
+
"can't determine purported responsible address",
|
33
32
|
'connections not accepted from servers without a valid sender domain',
|
34
33
|
'denied [bouncedeny]', # McAfee
|
35
34
|
'denied by secumail valid-address-filter',
|
@@ -55,6 +54,7 @@ module Sisimai
|
|
55
54
|
'returned mail not accepted here',
|
56
55
|
'rfc 1035 violation: recursive cname records for',
|
57
56
|
'rule imposed mailbox access for', # MailMarshal
|
57
|
+
'sending this from a different address or alias using the ',
|
58
58
|
'sender address has been blacklisted',
|
59
59
|
'sender email address rejected',
|
60
60
|
'sender is in my black list',
|
@@ -62,7 +62,8 @@ module Sisimai
|
|
62
62
|
'sender not pre-approved',
|
63
63
|
'sender rejected',
|
64
64
|
'sender domain is empty',
|
65
|
-
'sender verify failed',
|
65
|
+
'sender verify failed', # Exim callout
|
66
|
+
'spam reporting address', # SendGrid|a message to an address has previously been marked as Spam by the recipient.
|
66
67
|
'syntax error: empty email address',
|
67
68
|
'the message has been rejected by batv defense',
|
68
69
|
'this server does not accept mail from',
|
@@ -70,8 +71,9 @@ module Sisimai
|
|
70
71
|
'unroutable sender address',
|
71
72
|
'you are not allowed to post to this mailing list',
|
72
73
|
'you are sending to/from an address that has been blacklisted',
|
73
|
-
'your access to submit messages to this e-mail system has been rejected'
|
74
|
-
|
74
|
+
'your access to submit messages to this e-mail system has been rejected',
|
75
|
+
'your email address has been blacklisted', # MessageLabs
|
76
|
+
].freeze
|
75
77
|
|
76
78
|
def text; return 'rejected'; end
|
77
79
|
def description; return "Email rejected due to a sender's email address (envelope from)"; end
|
@@ -88,32 +90,32 @@ module Sisimai
|
|
88
90
|
end
|
89
91
|
|
90
92
|
# Rejected by the envelope sender address or not
|
91
|
-
# @param [Sisimai::
|
93
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
92
94
|
# @return [True,False] true: is rejected
|
93
95
|
# false: is not rejected by the sender
|
94
96
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
95
97
|
def true(argvs)
|
96
|
-
return true if argvs
|
97
|
-
tempreason = Sisimai::SMTP::Status.name(argvs
|
98
|
+
return true if argvs['reason'] == 'rejected'
|
99
|
+
tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus']) || 'undefined'
|
98
100
|
return true if tempreason == 'rejected' # Delivery status code points "rejected".
|
99
101
|
|
100
102
|
# Check the value of Diagnosic-Code: header with patterns
|
101
|
-
|
102
|
-
|
103
|
-
if
|
103
|
+
issuedcode = argvs['diagnosticcode'].downcase
|
104
|
+
thecommand = argvs['smtpcommand'] || ''
|
105
|
+
if thecommand == 'MAIL'
|
104
106
|
# The session was rejected at 'MAIL FROM' command
|
105
|
-
return true if match(
|
107
|
+
return true if match(issuedcode)
|
106
108
|
|
107
|
-
elsif
|
109
|
+
elsif thecommand == 'DATA'
|
108
110
|
# The session was rejected at 'DATA' command
|
109
111
|
if tempreason != 'userunknown'
|
110
112
|
# Except "userunknown"
|
111
|
-
return true if match(
|
113
|
+
return true if match(issuedcode)
|
112
114
|
end
|
113
115
|
elsif %w[onhold undefined securityerror systemerror].include?(tempreason)
|
114
|
-
# Try to match with message patterns when the temporary reason
|
115
|
-
#
|
116
|
-
return true if match(
|
116
|
+
# Try to match with message patterns when the temporary reason is "onhold", "undefined",
|
117
|
+
# "securityerror", or "systemerror"
|
118
|
+
return true if match(issuedcode)
|
117
119
|
end
|
118
120
|
return false
|
119
121
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Reason
|
3
|
+
# Sisimai::Reason::RequirePTR checks the bounce reason is "requireptr" or not. This class is
|
4
|
+
# called only from Sisimai::Reason class. This is the error that SMTP connection was rejected
|
5
|
+
# due to missing PTR record or having invalid PTR record at the source IP address used for the
|
6
|
+
# SMTP connection.
|
7
|
+
module RequirePTR
|
8
|
+
class << self
|
9
|
+
require 'sisimai/string'
|
10
|
+
|
11
|
+
Index = [
|
12
|
+
'access denied. ip name lookup failed',
|
13
|
+
'all mail servers must have a ptr record with a valid reverse dns entry',
|
14
|
+
'bad dns ptr resource record',
|
15
|
+
'cannot find your hostname',
|
16
|
+
'client host rejected: cannot find your hostname', # Yahoo!
|
17
|
+
'fix reverse dns for ',
|
18
|
+
'ips with missing ptr records',
|
19
|
+
'no ptr record found.',
|
20
|
+
'please get a custom reverse dns name from your isp for your host',
|
21
|
+
'ptr record setup',
|
22
|
+
'reverse dns failed',
|
23
|
+
'reverse dns required',
|
24
|
+
'sender ip reverse lookup rejected',
|
25
|
+
'the ip address sending this message does not have a ptr record setup', # Google
|
26
|
+
'the corresponding forward dns entry does not point to the sending ip', # Google
|
27
|
+
'this system will not accept messages from servers/devices with no reverse dns',
|
28
|
+
'unresolvable relay host name',
|
29
|
+
'we do not accept mail from hosts with dynamic ip or generic dns ptr-records',
|
30
|
+
].freeze
|
31
|
+
Pairs = [
|
32
|
+
['domain ',' mismatches client ip'],
|
33
|
+
['dns lookup failure: ', ' try again later'],
|
34
|
+
['reverse dns lookup for host ', ' failed permanently'],
|
35
|
+
['server access ', ' forbidden by invalid rdns record of your mail server'],
|
36
|
+
['service permits ', ' unverifyable sending ips'],
|
37
|
+
].freeze
|
38
|
+
|
39
|
+
def text; return 'requireptr'; end
|
40
|
+
def description; return 'Email rejected due to missing PTR record or having invalid PTR record'; end
|
41
|
+
|
42
|
+
# Try to match that the given text and regular expressions
|
43
|
+
# @param [String] argv1 String to be matched with regular expressions
|
44
|
+
# @return [True,False] false: Did not match
|
45
|
+
# true: Matched
|
46
|
+
def match(argv1)
|
47
|
+
return nil unless argv1
|
48
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
49
|
+
return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check the email rejected due to missing PTR record or having invalid PTR record OR not
|
54
|
+
# @param [Hash] argvs Hash to be detected the value of reason
|
55
|
+
# @return [true,false] true: is missing PTR or invalid PTR
|
56
|
+
# false: is not blocked due to missing PTR record
|
57
|
+
# @see http://www.ietf.org/rfc/rfc5322.txt
|
58
|
+
def true(argvs)
|
59
|
+
return true if argvs['reason'] == 'requireptr'
|
60
|
+
return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'requireptr'
|
61
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
62
|
+
return false
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::SecurityError checks the bounce reason is "securityerror"
|
4
|
-
#
|
3
|
+
# Sisimai::Reason::SecurityError checks the bounce reason is "securityerror" or not. This class
|
4
|
+
# is called only Sisimai::Reason class.
|
5
5
|
#
|
6
|
-
# This is the error that a security violation was detected on a destination
|
7
|
-
#
|
8
|
-
# address is camouflaged address.
|
6
|
+
# This is the error that a security violation was detected on a destination mail server. Depends
|
7
|
+
# on the security policy on the server, a sender's email address is camouflaged address.
|
9
8
|
#
|
10
|
-
# Sisimai will set "securityerror" to the reason
|
11
|
-
#
|
9
|
+
# Sisimai will set "securityerror" to the reason of email bounce if the value of Status: field
|
10
|
+
# in a bounce email is "5.7.*".
|
12
11
|
#
|
13
12
|
# Action: failed
|
14
13
|
# Status: 5.7.1
|
@@ -17,34 +16,31 @@ module Sisimai
|
|
17
16
|
# Last-Attempt-Date: Tue, 28 Apr 2009 11:02:45 +0900 (JST)
|
18
17
|
#
|
19
18
|
module SecurityError
|
20
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/SecurityError.pm
|
21
19
|
class << self
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
)
|
47
|
-
}x
|
20
|
+
require 'sisimai/string'
|
21
|
+
|
22
|
+
Index = [
|
23
|
+
'account not subscribed to ses',
|
24
|
+
'authentication credentials invalid',
|
25
|
+
'authentication failure',
|
26
|
+
'authentication required',
|
27
|
+
'authentication turned on in your email client',
|
28
|
+
'executable files are not allowed in compressed files',
|
29
|
+
'insecure mail relay',
|
30
|
+
'recipient address rejected: access denied',
|
31
|
+
"sorry, you don't authenticate or the domain isn't in my list of allowed rcpthosts",
|
32
|
+
'tls required but not supported', # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
|
33
|
+
'unauthenticated senders not allowed',
|
34
|
+
'verification failure',
|
35
|
+
'you are not authorized to send mail, authentication is required',
|
36
|
+
].freeze
|
37
|
+
Pairs = [
|
38
|
+
['authentication failed; server ', ' said: '], # Postfix
|
39
|
+
['authentification invalide', '305'],
|
40
|
+
['authentification requise', '402'],
|
41
|
+
['domain ', ' is a dead domain'],
|
42
|
+
['user ', ' is not authorized to perform ses:sendrawemail on resource'],
|
43
|
+
].freeze
|
48
44
|
|
49
45
|
def text; return 'securityerror'; end
|
50
46
|
def description; return 'Email rejected due to security violation was detected on a destination host'; end
|
@@ -55,12 +51,13 @@ module Sisimai
|
|
55
51
|
# true: Matched
|
56
52
|
def match(argv1)
|
57
53
|
return nil unless argv1
|
58
|
-
return true if argv1
|
54
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
55
|
+
return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
|
59
56
|
return false
|
60
57
|
end
|
61
58
|
|
62
59
|
# The bounce reason is security error or not
|
63
|
-
# @param [Sisimai::
|
60
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
64
61
|
# @return [True,False] true: is security error
|
65
62
|
# false: is not security error
|
66
63
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
@@ -1,151 +1,118 @@
|
|
1
1
|
module Sisimai
|
2
2
|
module Reason
|
3
|
-
# Sisimai::Reason::SpamDetected checks the bounce reason is "spamdetected"
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# This is the error that the message you sent was rejected by "spam filter"
|
8
|
-
# which is running on the remote host.
|
9
|
-
# This reason has added in Sisimai 4.1.25 and does not exist in any version
|
10
|
-
# of bounceHammer.
|
3
|
+
# Sisimai::Reason::SpamDetected checks the bounce reason is "spamdetected" due to Spam content
|
4
|
+
# in the message or not. This class is called only Sisimai::Reason class. This is the error that
|
5
|
+
# the message you sent was rejected by "spam filter" which is running on the remote host.
|
11
6
|
#
|
12
7
|
# Action: failed
|
13
8
|
# Status: 5.7.1
|
14
9
|
# Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, UBE, id=00000-00-000
|
15
10
|
# Last-Attempt-Date: Thu, 9 Apr 2008 23:34:45 +0900 (JST)
|
16
11
|
module SpamDetected
|
17
|
-
# Imported from p5-Sisimail/lib/Sisimai/Reason/SpamDetected.pm
|
18
12
|
class << self
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|was[ ]classified[ ]as[ ]spam
|
123
|
-
|was[ ]rejected[ ]by[ ]recurrent[ ]pattern[ ]detection[ ]system
|
124
|
-
)
|
125
|
-
|transaction[ ]failed[ ]spam[ ]message[ ]not[ ]queued # SendGrid
|
126
|
-
|we[ ]dont[ ]accept[ ]spam
|
127
|
-
|you're[ ]using[ ]a[ ]mass[ ]mailer
|
128
|
-
|your[ ](?:
|
129
|
-
email[ ](?:
|
130
|
-
appears[ ]similar[ ]to[ ]spam[ ]we[ ]have[ ]received[ ]before
|
131
|
-
|breaches[ ]local[ ]uribl[ ]policy
|
132
|
-
|had[ ]spam[-]like[ ]
|
133
|
-
|is[ ](?:considered|probably)[ ]spam
|
134
|
-
|was[ ]detected[ ]as[ ]spam
|
135
|
-
)
|
136
|
-
|message[ ](?:
|
137
|
-
as[ ]spam[ ]and[ ]has[ ]prevented[ ]delivery
|
138
|
-
|has[ ]been[ ](?:
|
139
|
-
temporarily[ ]blocked[ ]by[ ]our[ ]filter
|
140
|
-
|rejected[ ]because[ ]it[ ]appears[ ]to[ ]be[ ]spam
|
141
|
-
)
|
142
|
-
|has[ ]triggered[ ]a[ ]spam[ ]block
|
143
|
-
|may[ ]contain[ ]the[ ]spam[ ]contents
|
144
|
-
|failed[ ]several[ ]antispam[ ]checks
|
145
|
-
)
|
146
|
-
)
|
147
|
-
)
|
148
|
-
}x
|
13
|
+
require 'sisimai/string'
|
14
|
+
|
15
|
+
Index = [
|
16
|
+
' - spam',
|
17
|
+
'//www.spamhaus.org/help/help_spam_16.htm',
|
18
|
+
'//dsbl.org/help/help_spam_16.htm',
|
19
|
+
'//mail.163.com/help/help_spam_16.htm',
|
20
|
+
'554 5.7.0 reject, id=',
|
21
|
+
'appears to be unsolicited',
|
22
|
+
'blacklisted url in message',
|
23
|
+
'block for spam',
|
24
|
+
'blocked by policy: no spam please',
|
25
|
+
'blocked by spamassassin', # rejected by SpamAssassin
|
26
|
+
'blocked for abuse. see http://att.net/blocks', # AT&T
|
27
|
+
'cannot be forwarded because it was detected as spam',
|
28
|
+
'considered unsolicited bulk e-mail (spam) by our mail filters',
|
29
|
+
'content filter rejection',
|
30
|
+
'cyberoam anti spam engine has identified this email as a bulk email',
|
31
|
+
'denied due to spam list',
|
32
|
+
'high probability of spam',
|
33
|
+
'is classified as spam and is rejected',
|
34
|
+
'listed in work.drbl.imedia.ru',
|
35
|
+
'the mail server detected your message as spam and has prevented delivery.', # CPanel/Exim with SA rejections on
|
36
|
+
'mail appears to be unsolicited', # rejected due to spam
|
37
|
+
'mail content denied', # http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000726
|
38
|
+
'may consider spam',
|
39
|
+
'message considered as spam or virus',
|
40
|
+
'message contains spam or virus',
|
41
|
+
'message content rejected',
|
42
|
+
'message detected as spam',
|
43
|
+
'message filtered',
|
44
|
+
'message filtered. please see the faqs section on spam',
|
45
|
+
'message filtered. refer to the troubleshooting page at ',
|
46
|
+
'message looks like spam',
|
47
|
+
'message is being rejected as it seems to be a spam',
|
48
|
+
'message refused by mailmarshal spamprofiler',
|
49
|
+
'message refused by trustwave seg spamprofiler',
|
50
|
+
'message rejected as spam',
|
51
|
+
'message rejected because of unacceptable content',
|
52
|
+
'message rejected due to suspected spam content',
|
53
|
+
'message rejected for policy reasons',
|
54
|
+
'message was rejected for possible spam/virus content',
|
55
|
+
'our email server thinks this email is spam',
|
56
|
+
'our system has detected that this message is ',
|
57
|
+
'probable spam',
|
58
|
+
'reject bulk.advertising',
|
59
|
+
'rejected: spamassassin score ',
|
60
|
+
'rejected - bulk email',
|
61
|
+
'rejecting banned content',
|
62
|
+
'rejecting mail content',
|
63
|
+
'related to content with spam-like characteristics',
|
64
|
+
'sender domain listed at ',
|
65
|
+
'sending address not accepted due to spam filter',
|
66
|
+
'spam blocked',
|
67
|
+
'spam check',
|
68
|
+
'spam content matched',
|
69
|
+
'spam detected',
|
70
|
+
'spam email',
|
71
|
+
'spam email not accepted',
|
72
|
+
'spam message rejected.', # mail.ru
|
73
|
+
'spam not accepted',
|
74
|
+
'spam refused',
|
75
|
+
'spam rejection',
|
76
|
+
'spam score ',
|
77
|
+
'spambouncer identified spam', # SpamBouncer identified SPAM
|
78
|
+
'spamming not allowed',
|
79
|
+
'too much spam.', # Earthlink
|
80
|
+
'the email message was detected as spam',
|
81
|
+
'the message has been rejected by spam filtering engine',
|
82
|
+
'the message was rejected due to classification as bulk mail',
|
83
|
+
'the content of this message looked like spam', # SendGrid
|
84
|
+
'this message appears to be spam',
|
85
|
+
'this message has been identified as spam',
|
86
|
+
'this message has been scored as spam with a probability',
|
87
|
+
'this message was classified as spam',
|
88
|
+
'this message was rejected by recurrent pattern detection system',
|
89
|
+
'transaction failed spam message not queued', # SendGrid
|
90
|
+
'we dont accept spam',
|
91
|
+
'your email appears similar to spam we have received before',
|
92
|
+
'your email breaches local uribl policy',
|
93
|
+
'your email had spam-like ',
|
94
|
+
'your email is considered spam',
|
95
|
+
'your email is probably spam',
|
96
|
+
'your email was detected as spam',
|
97
|
+
'your message as spam and has prevented delivery',
|
98
|
+
'your message has been temporarily blocked by our filter',
|
99
|
+
'your message has been rejected because it appears to be spam',
|
100
|
+
'your message has triggered a spam block',
|
101
|
+
'your message may contain the spam contents',
|
102
|
+
'your message failed several antispam checks',
|
103
|
+
].freeze
|
104
|
+
Pairs = [
|
105
|
+
['greylisted', ' please try again in'],
|
106
|
+
['mail rejete. mail rejected. ', '506'],
|
107
|
+
['our filters rate at and above ', ' percent probability of being spam'],
|
108
|
+
['rejected by ', ' (spam)'],
|
109
|
+
['rejected due to spam ', 'classification'],
|
110
|
+
['rejected due to spam ', 'content'],
|
111
|
+
['rule imposed as ', ' is blacklisted on'],
|
112
|
+
['spam ', ' exceeded'],
|
113
|
+
['this message scored ', ' spam points'],
|
114
|
+
].freeze
|
115
|
+
Regex = %r/(?:\d[.]\d[.]\d|\d{3})[ ]spam\z/.freeze
|
149
116
|
|
150
117
|
def text; return 'spamdetected'; end
|
151
118
|
def description; return 'Email rejected by spam filter running on the remote host'; end
|
@@ -156,25 +123,27 @@ module Sisimai
|
|
156
123
|
# true: Matched
|
157
124
|
def match(argv1)
|
158
125
|
return nil unless argv1
|
126
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
127
|
+
return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
|
159
128
|
return true if argv1 =~ Regex
|
160
129
|
return false
|
161
130
|
end
|
162
131
|
|
163
132
|
# Rejected due to spam content in the message
|
164
|
-
# @param [Sisimai::
|
133
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
165
134
|
# @return [True,False] true: rejected due to spam
|
166
135
|
# false: is not rejected due to spam
|
167
136
|
# @see http://www.ietf.org/rfc/rfc2822.txt
|
168
137
|
def true(argvs)
|
169
|
-
return nil if argvs
|
170
|
-
return true if argvs
|
171
|
-
return true if Sisimai::SMTP::Status.name(argvs
|
138
|
+
return nil if argvs['deliverystatus'].empty?
|
139
|
+
return true if argvs['reason'] == 'spamdetected'
|
140
|
+
return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'spamdetected'
|
172
141
|
|
173
142
|
# The value of "reason" isn't "spamdetected" when the value of "smtpcommand" is an SMTP
|
174
143
|
# command to be sent before the SMTP DATA command because all the MTAs read the headers
|
175
144
|
# and the entire message body after the DATA command.
|
176
|
-
return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs
|
177
|
-
return true if match(argvs
|
145
|
+
return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs['smtpcommand'])
|
146
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
178
147
|
return false
|
179
148
|
end
|
180
149
|
|
@@ -183,5 +152,3 @@ module Sisimai
|
|
183
152
|
end
|
184
153
|
end
|
185
154
|
|
186
|
-
|
187
|
-
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Reason
|
3
|
+
# Sisimai::Reason::Speeding checks the bounce reason is "speeding" or not. This class is called
|
4
|
+
# only Sisimai::Reason class. This is the error that a connection rejected due to exceeding a
|
5
|
+
# rate limit or sending too fast.
|
6
|
+
module Speeding
|
7
|
+
class << self
|
8
|
+
Index = [
|
9
|
+
'mail sent from your IP address has been temporarily rate limited',
|
10
|
+
'please try again slower',
|
11
|
+
'receiving mail at a rate that prevents additional messages from being delivered',
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
def text; return 'speeding'; end
|
15
|
+
def description; return 'Rejected due to exceeding a rate limit or sending too fast'; end
|
16
|
+
|
17
|
+
# Try to match that the given text and regular expressions
|
18
|
+
# @param [String] argv1 String to be matched with regular expressions
|
19
|
+
# @return [True,False] false: Did not match
|
20
|
+
# true: Matched
|
21
|
+
def match(argv1)
|
22
|
+
return nil unless argv1
|
23
|
+
return true if Index.any? { |a| argv1.include?(a) }
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Speeding or not
|
28
|
+
# @param [Sisimai::Fact] argvs Object to be detected the reason
|
29
|
+
# @return [True,False] true: is speeding
|
30
|
+
# false: is not speeding
|
31
|
+
# @see http://www.ietf.org/rfc/rfc2822.txt
|
32
|
+
def true(argvs)
|
33
|
+
return nil if argvs['deliverystatus'].empty?
|
34
|
+
return true if argvs['reason'] == 'speeding'
|
35
|
+
|
36
|
+
# Action: failed
|
37
|
+
# Status: 4.7.1
|
38
|
+
# Remote-MTA: dns; smtp.example.jp
|
39
|
+
# Diagnostic-Code: smtp; 451 4.7.1 <mx.example.org[192.0.2.2]>: Client host rejected:
|
40
|
+
# Please try again slower
|
41
|
+
return true if match(argvs['diagnosticcode'].downcase)
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|