sisimai 4.25.14 → 4.25.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +51 -0
- data/README-JA.md +2 -2
- data/README.md +2 -2
- data/lib/sisimai/address.rb +1 -1
- data/lib/sisimai/data.rb +7 -3
- data/lib/sisimai/lhost/facebook.rb +10 -6
- data/lib/sisimai/lhost/googlegroups.rb +1 -2
- data/lib/sisimai/lhost/imailserver.rb +1 -1
- data/lib/sisimai/message.rb +15 -2
- data/lib/sisimai/mime.rb +1 -1
- data/lib/sisimai/reason/blocked.rb +2 -1
- data/lib/sisimai/reason/contenterror.rb +1 -0
- data/lib/sisimai/reason/filtered.rb +1 -0
- data/lib/sisimai/reason/networkerror.rb +1 -0
- data/lib/sisimai/reason/notaccept.rb +1 -0
- data/lib/sisimai/reason/policyviolation.rb +2 -0
- data/lib/sisimai/reason/rejected.rb +5 -0
- data/lib/sisimai/reason/spamdetected.rb +4 -0
- data/lib/sisimai/reason/userunknown.rb +8 -1
- data/lib/sisimai/rfc3464.rb +1 -1
- data/lib/sisimai/rfc3834.rb +0 -2
- data/lib/sisimai/rhost/exchangeonline.rb +711 -142
- data/lib/sisimai/rhost/googleapps.rb +239 -104
- data/lib/sisimai/rhost/mimecast.rb +290 -0
- data/lib/sisimai/rhost/nttdocomo.rb +118 -0
- data/lib/sisimai/rhost.rb +3 -1
- data/lib/sisimai/string.rb +2 -2
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/rhost-mimecast-01.eml +88 -0
- data/set-of-emails/maildir/bsd/rhost-mimecast-02.eml +90 -0
- data/set-of-emails/maildir/bsd/rhost-nttdocomo-01.eml +62 -0
- data/set-of-emails/maildir/bsd/rhost-nttdocomo-02.eml +89 -0
- data/set-of-emails/maildir/bsd/rhost-nttdocomo-03.eml +79 -0
- metadata +9 -2
@@ -0,0 +1,290 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Rhost
|
3
|
+
# Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data object as an argu-
|
4
|
+
# ment of get() method when the value of "rhost" of the object is "*.mimecast.com". This class
|
5
|
+
# is called only Sisimai::Fact class.
|
6
|
+
module Mimecast
|
7
|
+
class << self
|
8
|
+
MessagesOf = {
|
9
|
+
# https://community.mimecast.com/s/article/Mimecast-SMTP-Error-Codes-842605754
|
10
|
+
'blocked' => [
|
11
|
+
# - The sender's IP address has been blocked by a Blocked Senders Policy.
|
12
|
+
# - Remove the entry from the policy.
|
13
|
+
[421, 'sender address blocked'],
|
14
|
+
|
15
|
+
# - The Sender's IP address has been placed on the block list due to too many invalid
|
16
|
+
# connections.
|
17
|
+
# - The sender's mail server must retry the connection. The mail server performing the
|
18
|
+
# connection says the recipient address validation isn't responding.
|
19
|
+
[451, 'recipient temporarily unavailable'],
|
20
|
+
|
21
|
+
# - You've reached your mail server's limit.
|
22
|
+
# - Wait and try again. The mail server won't accept any messages until you're under
|
23
|
+
# the limit.
|
24
|
+
[451, 'ip temporarily blacklisted'],
|
25
|
+
|
26
|
+
# - The sending mail server is subjected to Greylisting. This requires the server to
|
27
|
+
# retry the connection, between one minute and 12 hours. Alternatively, the sender's
|
28
|
+
# IP address has a poor reputation.
|
29
|
+
# - These reputation checks can be bypassed with an Auto Allow or Permitted Senders
|
30
|
+
# policy. If it's legitimate traffic, amend your Greylisting policy.
|
31
|
+
[451, 'internal resources are temporarily unavailable'],
|
32
|
+
|
33
|
+
# - Ongoing reputation checks have resulted in the message being rejected due to poor
|
34
|
+
# IP reputation. This could occur after a 4xx error.
|
35
|
+
# - Create an Auto Allow or Permitted Senders policy.
|
36
|
+
# Note:
|
37
|
+
# You can request a review of your source IP ranges by completing our online form.
|
38
|
+
[550, 'local ct ip reputation - (reject)'],
|
39
|
+
|
40
|
+
# - The sender's IP address is listed in an RBL. The text displayed is specific to the
|
41
|
+
# RBL which lists the sender's IP address.
|
42
|
+
# - Bypass the RBL with an Auto Allow or Permitted Senders policy. Additionally request
|
43
|
+
# the associated IP address from the RBL.
|
44
|
+
#[550, '< details of RBL >'], NEED AN ACTUAL ERROR MESSAGE STRING
|
45
|
+
|
46
|
+
# - The inbound message has been rejected because the originated IP address isn't list-
|
47
|
+
# ed in the published SPF records for the sending domain.
|
48
|
+
# - Ensure all the IP addresses for your mail servers are listed in your SPF records.
|
49
|
+
# Alternatively, create a DNS Authentication (Inbound / Outbound) policy with the
|
50
|
+
# "Inbound SPF" or "Reject on Hard Fail" option disabled. Messages that fail our SPF
|
51
|
+
# checks are subjected to spam and RBL checks, instead of being rejected.
|
52
|
+
[550, 'spf sender invalid - envelope rejected'],
|
53
|
+
|
54
|
+
# - The DKIM key for the outbound message is broken and doesn't match the DNS record of
|
55
|
+
# the registered sender.
|
56
|
+
# - Check your organization's DNS record is populated with the right public key as part
|
57
|
+
# of the DNS Authentication Outbound Signing definition. The private key of the key-
|
58
|
+
# pair must be populated in the DNS Authentication policy, along with the domain and
|
59
|
+
# selector of that record.
|
60
|
+
[550, 'dkim sender invalid - envelope rejected'],
|
61
|
+
|
62
|
+
# - The inbound message has been rejected because the originated IP address isn't list-
|
63
|
+
# ed in the published SPF records for the sending domain.
|
64
|
+
# - Ensure all the IP addresses for your mail servers are listed in your SPF records.
|
65
|
+
[550, 'dmarc sender invalid - envelope rejected'],
|
66
|
+
],
|
67
|
+
'mesgtoobig' => [
|
68
|
+
# - The email size either exceeds an Email Size Limit policy or is larger than the
|
69
|
+
# Mimecast service limit. The default is 100 MB for the Legacy MTA, and 200 MB for
|
70
|
+
# "the Latest MTA".
|
71
|
+
# - Resend the message ensuring it's smaller than the limitation set. The transmission
|
72
|
+
# and content-encoding can add significantly to the total message size (e.g. a mes-
|
73
|
+
# sage with a 70 MB attachment, can have an overall size larger than 100 MB).
|
74
|
+
[554, 'maximum email size exceeded'],
|
75
|
+
],
|
76
|
+
'networkerror' => [
|
77
|
+
# - The message has too many "received headers" as it has been forwarded across multi-
|
78
|
+
# ple hops. Once 25 hops have been reached, the email is rejected.
|
79
|
+
# - Investigate the email addresses in the communication pairs, to see what forwarders
|
80
|
+
# are configured on the mail servers.
|
81
|
+
[554, 'mail loop detected'],
|
82
|
+
],
|
83
|
+
'norelaying' => [
|
84
|
+
# - Both the sender and recipient domains specified in the transmission are external to
|
85
|
+
# Mimecast, and aren't allowed to relay through the Mimecast service and/or the con-
|
86
|
+
# necting IP address isn't recognized as authorized.
|
87
|
+
# - Mimecast customers should contact Mimecast Support to add the Authorized Outbound
|
88
|
+
# address, or to take other remedial action.
|
89
|
+
[451, 'open relay not allowed'],
|
90
|
+
],
|
91
|
+
'notaccept' => [
|
92
|
+
# - The customer account Inbound emails are disabled in the Administration Console.
|
93
|
+
# - Contact Mimecast Support if the account's inbound traffic should be allowed.
|
94
|
+
[451, 'account inbounds disabled'],
|
95
|
+
],
|
96
|
+
'onhold' => [
|
97
|
+
# - The customer account outbound emails are disabled in the Administration Console.
|
98
|
+
# - Contact Mimecast Support if the account's outbound traffic should be allowed.
|
99
|
+
[451, 'account outbounds disabled'],
|
100
|
+
|
101
|
+
# - Omni Directional hostnames are enabled.
|
102
|
+
# - Disable Omni Directional hostnames.
|
103
|
+
[451, 'hostname is not authorized'],
|
104
|
+
|
105
|
+
# - Attempts are being made to journal mail that is past the set expiry threshold. The
|
106
|
+
# failure will be replaced by a retry response because the message is marked for re-
|
107
|
+
# try if rejected, causing the journal queue to grow.
|
108
|
+
# - Check to confirm there are no significant time discrepancies on the mail server.
|
109
|
+
# Discontinue journaling old messages past the expiry threshold.
|
110
|
+
[550, 'journal message past expiration'],
|
111
|
+
],
|
112
|
+
'policyviolation' => [
|
113
|
+
# - The message has triggered an Anti-Spoofing policy.
|
114
|
+
# - Create an Anti-Spoofing policy to take no action for the sender's address or IP ad-
|
115
|
+
# dress.
|
116
|
+
[550, 'anti-spoofing policy - inbound not allowed'],
|
117
|
+
[550, 'rejected by header-based anti-spoofing policy'],
|
118
|
+
|
119
|
+
# - The message has triggered a Content Examination policy.
|
120
|
+
# - Either create a Content Examination Bypass policy or adjust the Content Examination
|
121
|
+
# policy as required.
|
122
|
+
[550, 'message bounced due to content examination policy'],
|
123
|
+
|
124
|
+
# - The message has triggered a Geographical Restriction policy.
|
125
|
+
# - Delete or amend the policy.
|
126
|
+
[554, 'host network not allowed'],
|
127
|
+
],
|
128
|
+
'rejected' => [
|
129
|
+
# - The sender's email address or domain has triggered a Blocked Senders Policy or
|
130
|
+
# there's an SPF hard rejection.
|
131
|
+
# - Delete or modify the Blocked Senders policy to exclude the sender address.
|
132
|
+
[550, 'administrative prohibition envelope blocked'],
|
133
|
+
|
134
|
+
# - A personal block policy is in place for the email address/domain.
|
135
|
+
# - Remove the email address/domain from the Managed Senders list.
|
136
|
+
[550, 'envelope blocked – user entry'],
|
137
|
+
[550, 'envelope blocked – user domain entry'],
|
138
|
+
[550, 'rejected by header-based manually blocked senders - block for manual block'],
|
139
|
+
|
140
|
+
# - A Block Sender Policy has been applied to reject emails based on the Header From or
|
141
|
+
# Envelope From address.
|
142
|
+
# - Delete or change the Blocked Senders policy.
|
143
|
+
[550, 'rejected by header-based blocked senders - block policy for header from'],
|
144
|
+
[550, 'envelope rejected - block policy for envelope from address'],
|
145
|
+
],
|
146
|
+
'securityerror' => [
|
147
|
+
# - Messages submitted to SMTP port 587 require authentication. This error indicates
|
148
|
+
# the authentication details provided were incorrect.
|
149
|
+
# - Check your authentication details match an internal email address in Mimecast, with
|
150
|
+
# a corresponding Mimecast cloud password. Alternatively, consider sending the mes-
|
151
|
+
# sage on SMTP port 25.
|
152
|
+
[535, 'incorrect authentication data'],
|
153
|
+
[550, 'submitter failed to disabled'],
|
154
|
+
|
155
|
+
# - This email has been sent using SMTP, but TLS is required by policy.
|
156
|
+
# - Delete or change the Secure Receipt or Secure Delivery policy enforcing TLS.
|
157
|
+
# Alternatively, ensure the certificates on the mail server haven't expired. If using
|
158
|
+
# a proxy server, ensure it isn't intercepting the traffic and modifying encryption
|
159
|
+
# parameters.
|
160
|
+
[553, 'this route requires encryption (tls)'],
|
161
|
+
|
162
|
+
# - A TLS connection has been attempted using a TLS version that is lower than TLS 1.2.
|
163
|
+
# - Delete or change the Secure Receipt or Secure Delivery policy enforcing TLS.
|
164
|
+
# Alternatively, ensure the mail server attempting to connect is using the appropri-
|
165
|
+
# ate version of TLS.
|
166
|
+
[553, 'this route requires tls version 1.2 or greater'],
|
167
|
+
|
168
|
+
# - A secure connection was attempted using ciphers that do not meet the configured ci-
|
169
|
+
# pher strength.
|
170
|
+
# - Delete or change the Secure Receipt or Secure Delivery policy enforcing TLS. Alter-
|
171
|
+
# natively, ensure the certificates on the mail server haven't expired. If using a
|
172
|
+
# proxy server, ensure it isn't intercepting the traffic and modifying encryption
|
173
|
+
# parameters.
|
174
|
+
[553, 'this route requires high-strength ciphers'],
|
175
|
+
|
176
|
+
# - Validation on your umbrella account's domain name does not conform to your DNS.
|
177
|
+
# - Check you DNS has the required umbrella accounts listed as comma-separated values.
|
178
|
+
[554, 'configuration is invalid for this certificate'],
|
179
|
+
],
|
180
|
+
'systemerror' => [
|
181
|
+
# - The Mimecast server is under maximum load.
|
182
|
+
# - No action is required from the end-user. The message will retry 30 times and when
|
183
|
+
# server resources are available, the message is processed.
|
184
|
+
[451, 'unable to process connection at this time'],
|
185
|
+
|
186
|
+
# - The message was incorrectly terminated. This can be caused by:
|
187
|
+
# - Files that previously contained a virus, but haven't been cleaned by an anti-virus
|
188
|
+
# product, leaving traces in the message.
|
189
|
+
# - Firewall issues on the sender's side.
|
190
|
+
# - Incorrectly configured content rules on a security device.
|
191
|
+
# - Investigate the Intrusion Detection software or other SMTP protocol analyzers. If
|
192
|
+
# running a Cisco Firewall, ensure the Mail- guard or SMTP Fixup module is disabled.
|
193
|
+
[451, 'message ended early'],
|
194
|
+
|
195
|
+
# - Generic error if the reason is unknown
|
196
|
+
# - Contact Mimecast Support.
|
197
|
+
[451, 'unable to process command'],
|
198
|
+
|
199
|
+
# - Generic error if the reason is unknown
|
200
|
+
# - Contact Mimecast Support.
|
201
|
+
[451, 'unable to process an email at this time'],
|
202
|
+
],
|
203
|
+
'toomanyconn' => [
|
204
|
+
# - There are too many concurrent inbound connections for the account. The default is 20.
|
205
|
+
# - The IP address is automatically removed from the block list after five minutes.
|
206
|
+
# Continued invalid connections result in the IP being readded to the block list. En-
|
207
|
+
# sure you don't route outbound or journal messages to Mimecast from an IP address
|
208
|
+
# that hasn't been authorized to do so.
|
209
|
+
[451, 'account service is temporarily unavailable'],
|
210
|
+
|
211
|
+
# - The sending server issues more than 100 RCPT TO entries. By default, Mimecast only
|
212
|
+
# accepts 100 RCPT TO entries per message body (DATA). The error triggers the sending
|
213
|
+
# mail server to provide the DATA for the first 100 recipients before it provides the
|
214
|
+
# next batch of RCPT TO entries.
|
215
|
+
# - Most mail servers respect the transient error and treat it as a "truncation request".
|
216
|
+
# If your mail server, firewall, or on-site solution doesn't respect the error, you
|
217
|
+
# must ensure that no more than 100 recipients are submitted.
|
218
|
+
# Note:
|
219
|
+
# Solutions like SMTP Fix-Up / MailGuard and ESMTP inspection on Cisco Pix and
|
220
|
+
# ASA Firewalls are known not to respect the transient error. We advise you to
|
221
|
+
# disable this functionality.
|
222
|
+
[452, 'too many recipients'],
|
223
|
+
|
224
|
+
# - There are too many concurrent outbound connections for the account.
|
225
|
+
# - Send the messages in smaller chunks to recipients.
|
226
|
+
[550, 'exceeding outbound thread limit'],
|
227
|
+
],
|
228
|
+
'userunknown' => [
|
229
|
+
# - The email address isn't a valid SMTP address.
|
230
|
+
# - The sender must resend the message to a valid internal email address.
|
231
|
+
[501, 'invalid address'],
|
232
|
+
|
233
|
+
# - The server has encountered a bad sequence of commands, or it requires an authenti-
|
234
|
+
# cation.
|
235
|
+
# - In case of a "bad sequence", the server has pulled off its commands in the wrong
|
236
|
+
# order, usually because of a broken connection. If authentication is needed, enter
|
237
|
+
# your username and password.
|
238
|
+
[503, 'user unknown'],
|
239
|
+
|
240
|
+
# - Known recipient, LDAP, or SMTP call forwarding recipient validation checks haven't
|
241
|
+
# returned a valid internal user.
|
242
|
+
# - The sender must resend the message to a valid internal recipient address.
|
243
|
+
[550, 'invalid recipient'],
|
244
|
+
],
|
245
|
+
'virusdetected' => [
|
246
|
+
# - A signature was detected that could either be a virus, or a spam score over the
|
247
|
+
# maximum threshold. The spam score isn't available in the Administration Console. If
|
248
|
+
# you aren't a Mimecast customer but have emails rejected with this error code, con-
|
249
|
+
# tact the recipient to adjust their configuration and permit your address. If unsuc-
|
250
|
+
# cessful, your IT department can submit a request to review these email rejections
|
251
|
+
# via our Sender Feedback form.
|
252
|
+
# - Anti-virus checks cannot be bypassed. Contact the sender to see if they can stop
|
253
|
+
# these messages from being blocked. Anti-spam checks can be bypassed using a Per-
|
254
|
+
# mitted Senders or Auto Allow policy. Rejected emails can be viewed in your Outbound
|
255
|
+
# Activity and searching for the required email address.
|
256
|
+
[554, 'email rejected due to security policies'],
|
257
|
+
],
|
258
|
+
}.freeze
|
259
|
+
|
260
|
+
# Detect bounce reason from Mimecast
|
261
|
+
# @param [Sisimai::Fact] argvs Parsed email object
|
262
|
+
# @return [String] The bounce reason for mimecast.com
|
263
|
+
def get(argvs)
|
264
|
+
return '' unless argvs.replycode =~ /\A[245]\d\d\z/
|
265
|
+
return '' unless argvs.diagnosticcode
|
266
|
+
|
267
|
+
esmtperror = argvs.diagnosticcode.downcase || ''
|
268
|
+
esmtpreply = argvs.replycode.to_i
|
269
|
+
reasontext = ''
|
270
|
+
|
271
|
+
MessagesOf.each_key do |e|
|
272
|
+
# Try to match the error message with message patterns defined in "MessagesOf"
|
273
|
+
MessagesOf[e].each do |f|
|
274
|
+
# Find an error reason
|
275
|
+
next unless esmtpreply == f[0]
|
276
|
+
next unless esmtperror.include?(f[1])
|
277
|
+
reasontext = e
|
278
|
+
break
|
279
|
+
end
|
280
|
+
break unless reasontext.empty?
|
281
|
+
end
|
282
|
+
|
283
|
+
return reasontext
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module Rhost
|
3
|
+
# Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data object as an argument
|
4
|
+
# of get() method when the value of "rhost" of the object is "mfsmax.docomo.ne.jp". This class
|
5
|
+
# is called only Sisimai::Data class.
|
6
|
+
module NTTDOCOMO
|
7
|
+
class << self
|
8
|
+
MessagesOf = {
|
9
|
+
'mailboxfull' => %r/552 too much mail data/,
|
10
|
+
'toomanyconn' => %r/552 too many recipients/,
|
11
|
+
'syntaxerror' => %r/(?:503 bad sequence of commands|504 command parameter not implemented)/,
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
# Detect bounce reason from NTT DOCOMO
|
15
|
+
# @param [Sisimai::Data] argvs Parsed email object
|
16
|
+
# @return [String] The bounce reason for docomo.ne.jp
|
17
|
+
def get(argvs)
|
18
|
+
statuscode = argvs.deliverystatus || ''
|
19
|
+
commandtxt = argvs.smtpcommand || ''
|
20
|
+
esmtperror = argvs.diagnosticcode.downcase || ''
|
21
|
+
reasontext = ''
|
22
|
+
|
23
|
+
# Check the value of Status: field, an SMTP Reply Code, and the SMTP Command
|
24
|
+
if statuscode == '5.1.1' || statuscode == '5.0.911'
|
25
|
+
# ----- Transcript of session follows -----
|
26
|
+
# ... while talking to mfsmax.docomo.ne.jp.:
|
27
|
+
# >>> RCPT To:<***@docomo.ne.jp>
|
28
|
+
# <<< 550 Unknown user ***@docomo.ne.jp
|
29
|
+
# 550 5.1.1 <***@docomo.ne.jp>... User unknown
|
30
|
+
# >>> DATA
|
31
|
+
# <<< 503 Bad sequence of commands
|
32
|
+
reasontext = 'userunknown'
|
33
|
+
|
34
|
+
elsif statuscode == '5.2.0'
|
35
|
+
# ----- The following addresses had permanent fatal errors -----
|
36
|
+
# <***@docomo.ne.jp>
|
37
|
+
# (reason: 550 Unknown user ***@docomo.ne.jp)
|
38
|
+
#
|
39
|
+
# ----- Transcript of session follows -----
|
40
|
+
# ... while talking to mfsmax.docomo.ne.jp.:
|
41
|
+
# >>> DATA
|
42
|
+
# <<< 550 Unknown user ***@docomo.ne.jp
|
43
|
+
# 554 5.0.0 Service unavailable
|
44
|
+
# ...
|
45
|
+
# Final-Recipient: RFC822; ***@docomo.ne.jp
|
46
|
+
# Action: failed
|
47
|
+
# Status: 5.2.0
|
48
|
+
reasontext = 'filtered'
|
49
|
+
|
50
|
+
else
|
51
|
+
# The value of "Diagnostic-Code:" field is not empty
|
52
|
+
MessagesOf.each_key do |e|
|
53
|
+
# Try to match the error message with message patterns defined in "MessagesOf"
|
54
|
+
next unless esmtperror =~ MessagesOf[e]
|
55
|
+
reasontext = e
|
56
|
+
break
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if reasontext.empty?
|
61
|
+
# A bounce reason did not decide from a status code, an error message.
|
62
|
+
if statuscode == '5.0.0'
|
63
|
+
# Status: 5.0.0
|
64
|
+
if commandtxt == 'RCPT'
|
65
|
+
# Your message to the following recipients cannot be delivered:
|
66
|
+
#
|
67
|
+
# <***@docomo.ne.jp>:
|
68
|
+
# mfsmax.docomo.ne.jp [203.138.181.112]:
|
69
|
+
# >>> RCPT TO:<***@docomo.ne.jp>
|
70
|
+
# <<< 550 Unknown user ***@docomo.ne.jp
|
71
|
+
# ...
|
72
|
+
#
|
73
|
+
# Final-Recipient: rfc822; ***@docomo.ne.jp
|
74
|
+
# Action: failed
|
75
|
+
# Status: 5.0.0
|
76
|
+
# Remote-MTA: dns; mfsmax.docomo.ne.jp [203.138.181.112]
|
77
|
+
# Diagnostic-Code: smtp; 550 Unknown user ***@docomo.ne.jp
|
78
|
+
reasontext = 'userunknown'
|
79
|
+
|
80
|
+
elsif commandtxt == 'DATA'
|
81
|
+
# <***@docomo.ne.jp>: host mfsmax.docomo.ne.jp[203.138.181.240] said:
|
82
|
+
# 550 Unknown user ***@docomo.ne.jp (in reply to end of DATA
|
83
|
+
# command)
|
84
|
+
# ...
|
85
|
+
# Final-Recipient: rfc822; ***@docomo.ne.jp
|
86
|
+
# Original-Recipient: rfc822;***@docomo.ne.jp
|
87
|
+
# Action: failed
|
88
|
+
# Status: 5.0.0
|
89
|
+
# Remote-MTA: dns; mfsmax.docomo.ne.jp
|
90
|
+
# Diagnostic-Code: smtp; 550 Unknown user ***@docomo.ne.jp
|
91
|
+
reasontext = 'rejected'
|
92
|
+
|
93
|
+
else
|
94
|
+
# Rejected by other SMTP commands: AUTH, MAIL,
|
95
|
+
# もしもこのブロックを通過するNTTドコモからのエラーメッセージを見つけたら
|
96
|
+
# https://github.com/sisimai/p5-sisimai/issues からご連絡ねがいます。
|
97
|
+
#
|
98
|
+
# If you found a error message from mfsmax.docomo.ne.jp which passes this block,
|
99
|
+
# please open an issue at https://github.com/sisimai/p5-sisimai/issues .
|
100
|
+
end
|
101
|
+
else
|
102
|
+
# Status: field is neither 5.0.0 nor values defined in code above
|
103
|
+
# もしもこのブロックを通過するNTTドコモからのエラーメッセージを見つけたら
|
104
|
+
# https://github.com/sisimai/p5-sisimai/issues からご連絡ねがいます。
|
105
|
+
#
|
106
|
+
# If you found a error message from mfsmax.docomo.ne.jp which passes this block,
|
107
|
+
#
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
return reasontext
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
data/lib/sisimai/rhost.rb
CHANGED
@@ -7,6 +7,7 @@ module Sisimai
|
|
7
7
|
class << self
|
8
8
|
# Imported from p5-Sisimail/lib/Sisimai/Rhost.pm
|
9
9
|
RhostClass = {
|
10
|
+
'cox.net' => 'Cox',
|
10
11
|
'.prod.outlook.com' => 'ExchangeOnline',
|
11
12
|
'.protection.outlook.com' => 'ExchangeOnline',
|
12
13
|
'laposte.net' => 'FrancePTT',
|
@@ -19,8 +20,9 @@ module Sisimai
|
|
19
20
|
'.email.ua' => 'IUA',
|
20
21
|
'lsean.ezweb.ne.jp' => 'KDDI',
|
21
22
|
'msmx.au.com' => 'KDDI',
|
23
|
+
'.mimecast.com' => 'Mimecast',
|
24
|
+
'mfsmax.docomo.ne.jp' => 'NTTDOCOMO',
|
22
25
|
'charter.net' => 'Spectrum',
|
23
|
-
'cox.net' => 'Cox',
|
24
26
|
'.qq.com' => 'TencentQQ',
|
25
27
|
}.freeze
|
26
28
|
|
data/lib/sisimai/string.rb
CHANGED
@@ -66,8 +66,8 @@ module Sisimai
|
|
66
66
|
# 3. <a href = 'http://...'>...</a> to " http://... "
|
67
67
|
# 4. <a href = 'mailto:...'>...</a> to " Value <mailto:...> "
|
68
68
|
plain.scrub!('?')
|
69
|
-
plain.gsub!(%r|<head
|
70
|
-
plain.gsub!(%r|<style
|
69
|
+
plain.gsub!(%r|<head>.*?</head>|im, '')
|
70
|
+
plain.gsub!(%r|<style.*?>.*?</style>|im, '')
|
71
71
|
plain.gsub!(%r|<a\s+href\s*=\s*['"](https?://.+?)['"].*?>(.*?)</a>|i, '[\2](\1)')
|
72
72
|
plain.gsub!(%r|<a\s+href\s*=\s*["']mailto:([^\s]+?)["']>(.*?)</a>|i, '[\2](mailto:\1)')
|
73
73
|
|
data/lib/sisimai/version.rb
CHANGED
@@ -0,0 +1,88 @@
|
|
1
|
+
Return-Path: <>
|
2
|
+
Delivered-To: kijitora@example.co.jp
|
3
|
+
Received: from smtp.example.co.jp
|
4
|
+
by neko.example.co.jp (Dovecot) with LMTP id YZv2MOmWGmDvLgAA4iEyMQ
|
5
|
+
for <kijitora@example.co.jp>; Thu, 02 Feb 2021 23:34:45 +0900
|
6
|
+
Received: by smtp.example.co.jp (Postfix)
|
7
|
+
id PcWLPhBbNNzq4GD0; Thu, 2 Feb 2021 23:34:45 +0900 (JST)
|
8
|
+
Date: Thu, 2 Feb 2021 23:34:45 +0900 (JST)
|
9
|
+
From: MAILER-DAEMON@smtp.example.co.jp (Mail Delivery System)
|
10
|
+
Subject: Undelivered Mail Returned to Sender
|
11
|
+
To: kijitora@example.co.jp
|
12
|
+
Auto-Submitted: auto-replied
|
13
|
+
MIME-Version: 1.0
|
14
|
+
Content-Type: multipart/report; report-type=delivery-status;
|
15
|
+
boundary="XkB0QWwjfhzQcf0c.160000000/smtp.example.co.jp"
|
16
|
+
Content-Transfer-Encoding: 8bit
|
17
|
+
Message-Id: <PcWLPhBbNNzq4GD0@smtp.example.co.jp>
|
18
|
+
|
19
|
+
This is a MIME-encapsulated message.
|
20
|
+
|
21
|
+
--XkB0QWwjfhzQcf0c.160000000/smtp.example.co.jp
|
22
|
+
Content-Description: Notification
|
23
|
+
Content-Type: text/plain; charset=utf-8
|
24
|
+
Content-Transfer-Encoding: 8bit
|
25
|
+
|
26
|
+
This is the mail system at host smtp.example.co.jp.
|
27
|
+
|
28
|
+
I'm sorry to have to inform you that your message could not
|
29
|
+
be delivered to one or more recipients. It's attached below.
|
30
|
+
|
31
|
+
For further assistance, please send mail to postmaster.
|
32
|
+
|
33
|
+
If you do so, please include this problem report. You can
|
34
|
+
delete your own text from the attached returned message.
|
35
|
+
|
36
|
+
The mail system
|
37
|
+
|
38
|
+
<sabatora@example.com>: host
|
39
|
+
us-smtp-inbound-1.mimecast.com[207.211.30.221] said: 554 Host network not
|
40
|
+
allowed - https://community.mimecast.com/docs/DOC-1369#554
|
41
|
+
[z7qZw5BPd1zlDYHka4589ru.us222] (in reply to RCPT TO command)
|
42
|
+
|
43
|
+
--XkB0QWwjfhzQcf0c.160000000/smtp.example.co.jp
|
44
|
+
Content-Description: Delivery report
|
45
|
+
Content-Type: message/delivery-status
|
46
|
+
|
47
|
+
Reporting-MTA: dns; smtp.example.co.jp
|
48
|
+
X-Postfix-Queue-ID: XkB0QWwjfhzQcf0c
|
49
|
+
X-Postfix-Sender: rfc822; kijitora@example.co.jp
|
50
|
+
Arrival-Date: Thu, 2 Feb 2021 23:34:45 +0900 (JST)
|
51
|
+
|
52
|
+
Final-Recipient: rfc822; sabatora@example.com
|
53
|
+
Original-Recipient: rfc822;sabatora@example.com
|
54
|
+
Action: failed
|
55
|
+
Status: 5.0.0
|
56
|
+
Remote-MTA: dns; us-smtp-inbound-1.mimecast.com
|
57
|
+
Diagnostic-Code: smtp; 554 Host network not allowed -
|
58
|
+
https://community.mimecast.com/docs/DOC-1369#554
|
59
|
+
[z7qZw5BPd1zlDYHka4589ru.us222]
|
60
|
+
|
61
|
+
--XkB0QWwjfhzQcf0c.160000000/smtp.example.co.jp
|
62
|
+
Content-Description: Undelivered Message
|
63
|
+
Content-Type: message/rfc822
|
64
|
+
Content-Transfer-Encoding: 8bit
|
65
|
+
|
66
|
+
Return-Path: <kijitora@example.co.jp>
|
67
|
+
Received: from 6bBckZSRc0zMvk9Z (unknown [192.0.2.2])
|
68
|
+
(Authenticated sender: kijitora@example.co.jp)
|
69
|
+
by smtp.example.co.jp (Postfix) with ESMTPSA id XkB0QWwjfhzQcf0c
|
70
|
+
for <sabatora@example.com>; Thu, 2 Feb 2021 23:34:45 +0900 (JST)
|
71
|
+
From: Automated Message <kijitora@example.co.jp>
|
72
|
+
Date: Thu, 2 Feb 2021 23:34:45 +0100
|
73
|
+
Subject: Automatic reply : domain owner (Reg-C)
|
74
|
+
Message-ID: <7B0s8rbG08zYDdPt.WaOHIQht053802@NEKO-NYAAN-22.LOCAL>
|
75
|
+
To: sabatora@example.com
|
76
|
+
X-Mailer: NEKO-NYAAN
|
77
|
+
MIME-Version: 1.0
|
78
|
+
Content-Type: multipart/alternative;
|
79
|
+
boundary="=-QX/4rTBwaN4065581=="
|
80
|
+
Content-Transfer-Encoding: 8bit
|
81
|
+
|
82
|
+
--=-QX/4rTBwaN4065581==
|
83
|
+
Content-Type: text/plain; charset=us-ascii
|
84
|
+
|
85
|
+
--=-QX/4rTBwaN4065581==--
|
86
|
+
|
87
|
+
|
88
|
+
--XkB0QWwjfhzQcf0c.160000000/smtp.example.co.jp--
|
@@ -0,0 +1,90 @@
|
|
1
|
+
Delivered-To: automated-bounces+feffeeff-0002-ebbb-8192-00101100ffefee@email.example.com
|
2
|
+
Received: by 192.0.2.117 with SMTP id UfAUHGQO080319;
|
3
|
+
Thu, 29 Apr 2022 23:34:45 -0800 (PST)
|
4
|
+
Received: by 192.0.2.116 with SMTP id zwKF2wfslXzPbG51.22.20220022322;
|
5
|
+
Thu, 29 Apr 2022 23:34:45 -0800 (PST)
|
6
|
+
Return-Path: <>
|
7
|
+
Received: from nyaan2.example.co.uk (nyaan2.example.co.uk. [192.0.2.117])
|
8
|
+
by mx.google.com with ESMTP id 2mcBI4Uh025855.114.2022.04.29.23.34.45;
|
9
|
+
Thu, 29 Apr 2022 23:34:45 -0800 (PST)
|
10
|
+
Received-SPF: pass (google.com: domain of nyaan2.example.co.uk designates 192.0.2.117 as permitted sender) client-ip=192.0.2.117;
|
11
|
+
Authentication-Results: mx.google.com; spf=pass (google.com: domain of nyaan2.example.co.uk designates 192.0.2.117 as permitted sender) smtp.mail=
|
12
|
+
Received: by nyaan2.example.co.uk (Postfix)
|
13
|
+
id zyrWXqvX71zdjmrD; Thu, 29 Apr 2022 23:34:45 +0000 (GMT)
|
14
|
+
Date: Thu, 29 Apr 2022 23:34:45 +0000 (GMT)
|
15
|
+
From: MAILER-DAEMON@nyaan2.example.co.uk (Mail Delivery System)
|
16
|
+
Subject: Undelivered Mail Returned to Sender
|
17
|
+
To: automated-bounces+7BE1D472-4B2D-11E1-9E82-A342CB4AA966@email.example.com
|
18
|
+
Auto-Submitted: auto-replied
|
19
|
+
MIME-Version: 1.0
|
20
|
+
Content-Type: multipart/report; report-type=delivery-status;
|
21
|
+
boundary="316C411E8435.000000000/nyaan2.example.co.uk"
|
22
|
+
Message-Id: <20220429233445.zyrWXqvX71zdjmrD@nyaan2.example.co.uk>
|
23
|
+
|
24
|
+
This is a MIME-encapsulated message.
|
25
|
+
|
26
|
+
--316C411E8435.000000000/nyaan2.example.co.uk
|
27
|
+
Content-Description: Notification
|
28
|
+
Content-Type: text/plain; charset=us-ascii
|
29
|
+
|
30
|
+
This is the mail system at host nyaan2.example.co.uk.
|
31
|
+
|
32
|
+
I'm sorry to have to inform you that your message could not
|
33
|
+
be delivered to one or more recipients. It's attached below.
|
34
|
+
|
35
|
+
For further assistance, please send mail to <postmaster>
|
36
|
+
|
37
|
+
If you do so, please include this problem report. You can
|
38
|
+
delete your own text from the attached returned message.
|
39
|
+
|
40
|
+
The mail system
|
41
|
+
|
42
|
+
<kijitora@sample.co.uk>: host service222.mimecast.com[91.220.42.51] said: 554
|
43
|
+
email rejected due to security policies - MCSpamSignature.sa.2.2 (in reply
|
44
|
+
to end of DATA command)
|
45
|
+
|
46
|
+
--316C411E8435.000000000/nyaan2.example.co.uk
|
47
|
+
Content-Description: Delivery report
|
48
|
+
Content-Type: message/delivery-status
|
49
|
+
|
50
|
+
Reporting-MTA: dns; nyaan2.example.co.uk
|
51
|
+
X-Postfix-Queue-ID: 316C411E8435
|
52
|
+
X-Postfix-Sender: rfc822; automated-bounces+FFFFFFFF-0000-EEEE-EEEE-00000000EEEE@email.example.com
|
53
|
+
Arrival-Date: Thu, 29 Apr 2022 23:34:45 +0000 (GMT)
|
54
|
+
|
55
|
+
Final-Recipient: rfc822; kijitora@sample.co.uk
|
56
|
+
Action: failed
|
57
|
+
Status: 5.0.0
|
58
|
+
Remote-MTA: dns; service222.mimecast.com
|
59
|
+
Diagnostic-Code: smtp; 554 email rejected due to security policies -
|
60
|
+
MCSpamSignature.sa.2.2
|
61
|
+
|
62
|
+
--316C411E8435.000000000/nyaan2.example.co.uk
|
63
|
+
Content-Description: Undelivered Message
|
64
|
+
Content-Type: message/rfc822
|
65
|
+
|
66
|
+
Received: by nyaan2.example.co.uk (Postfix, from userid 222)
|
67
|
+
id 316C411E8435; Thu, 29 Apr 2022 23:34:45 +0000 (GMT)
|
68
|
+
MIME-Version: 1.0
|
69
|
+
Content-Transfer-Encoding: 7bit
|
70
|
+
Content-Type: multipart/related; boundary="_----------=_1055808412000000"
|
71
|
+
Date: Thu, 29 Apr 2022 23:34:45 +0000
|
72
|
+
From: Neko <neko@email.example.com>
|
73
|
+
Subject: Nyaan
|
74
|
+
To: Kijitora Nyaan <kijitora@sample.co.uk>
|
75
|
+
Message-Id: <20220429.0000.316C411E8435@nyaan2.example.co.uk>
|
76
|
+
|
77
|
+
This is a multi-part message in MIME format.
|
78
|
+
|
79
|
+
--_----------=_1055808412000000
|
80
|
+
Content-Disposition: inline
|
81
|
+
Content-Transfer-Encoding: quoted-printable
|
82
|
+
Content-Type: text/html
|
83
|
+
|
84
|
+
Nyaan
|
85
|
+
|
86
|
+
--_----------=_1055808412000000--
|
87
|
+
|
88
|
+
|
89
|
+
--316C411E8435.000000000/nyaan2.example.co.uk--
|
90
|
+
|