sisimai 4.25.13-java → 4.25.15-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,117 +3,700 @@ module Sisimai
3
3
  # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data
4
4
  # object as an argument of get() method when the value of "rhost" of the object
5
5
  # is "*.protection.outlook.com". This class is called only Sisimai::Data class.
6
+ #
7
+ # https://technet.microsoft.com/en-us/library/bb232118
8
+ # https://learn.microsoft.com/en-us/Exchange/mail-flow-best-practices/non-delivery-reports-in-exchange-online/non-delivery-reports-in-exchange-online
9
+ # https://learn.microsoft.com/en-us/Exchange/mail-flow/non-delivery-reports-and-bounce-messages/non-delivery-reports-and-bounce-messages
6
10
  module ExchangeOnline
7
11
  class << self
8
- # Imported from p5-Sisimail/lib/Sisimai/Rhost/ExchangeOnline.pm
9
-
10
- # https://technet.microsoft.com/en-us/library/bb232118
11
- StatusList = {
12
- '4.3.1' => [{ reason: 'systemfull', string: 'Insufficient system resources' }],
13
- '4.3.2' => [{ reason: 'notaccept', string: 'System not accepting network messages' }],
14
- '4.4.2' => [{ reason: 'blocked', string: 'Connection dropped' }],
15
- '4.7.26' => [{
16
- reason: 'securityerror',
17
- string: 'must pass either SPF or DKIM validation, this message is not signed'
18
- }],
19
- '5.0.0' => [{ reason: 'blocked', string: 'HELO / EHLO requires domain address' }],
20
- '5.1.4' => [{ reason: 'systemerror', string: 'Destination mailbox address ambiguous' }],
21
- '5.2.1' => [{ reason: 'suspend', string: 'Mailbox cannot be accessed' }],
22
- '5.2.2' => [{ reason: 'mailboxfull', string: 'Mailbox full' }],
23
- '5.2.3' => [{ reason: 'exceedlimit', string: 'Message too large' }],
24
- '5.2.4' => [{ reason: 'systemerror', string: 'Mailing list expansion problem' }],
25
- '5.2.14' => [{ reason: 'systemerror', string: 'misconfigured forwarding address' }],
26
- '5.2.122' => [{ reason: 'toomanyconn' ,string: 'The recipient has exceeded their limit for' }],
27
- '5.3.3' => [{ reason: 'systemfull', string: 'Unrecognized command' }],
28
- '5.3.4' => [{ reason: 'mesgtoobig', string: 'Message too big for system' }],
29
- '5.3.5' => [{ reason: 'systemerror', string: 'System incorrectly configured' }],
30
- '5.4.1' => [{ reason: 'rejected', string: 'Recipient address rejected: Access denied' }],
31
- '5.4.11' => [{ reason: 'contenterror',string: 'Agent generated message depth exceeded' }],
32
- '5.4.14' => [{ reason: 'networkerror',string: 'Hop count exceeded' }],
33
- '5.4.310' => [{ reason: 'systemerror', string: 'does not exist' }], # DNS domain * does not exist
34
- '5.5.2' => [{ reason: 'syntaxerror', string: 'Send hello first' }],
35
- '5.5.3' => [{ reason: 'syntaxerror', string: 'Too many recipients' }],
36
- '5.5.4' => [{ reason: 'filtered', string: 'Invalid domain name' }],
37
- '5.5.6' => [{ reason: 'contenterror',string: 'Invalid message content' }],
38
- '5.7.1' => [
39
- { reason: 'securityerror', string: 'Delivery not authorized' },
40
- { reason: 'securityerror', string: 'Client was not authenticated' },
41
- { reason: 'norelaying', string: 'Unable to relay' },
42
- ],
43
- '5.7.25' => [{ reason: 'blocked', string: 'must have a reverse DNS record' }],
44
- '5.7.51' => [{ reason: 'blocked', string: 'RestrictDomainsToIPAddresses or RestrictDomainsToCertificate' }],
45
- '5.7.506' => [{ reason: 'blocked', string: 'Bad HELO' }],
46
- '5.7.508' => [{ reason: 'toomanyconn', string: 'has exceeded permitted limits within ' }],
47
- '5.7.509' => [{ reason: 'rejected', string: 'does not pass DMARC verification' }],
48
- '5.7.510' => [{ reason: 'notaccept', string: 'does not accept email over IPv6' }],
49
- '5.7.511' => [{ reason: 'blocked', string: 'banned sender' }],
50
- '5.7.512' => [{ reason: 'contenterror', string: 'message must be RFC 5322' }],
51
- }.freeze
52
- ReStatuses = {
53
- %r/\A4[.]4[.][17]\z/ => [
54
- { reason: 'expired', string: ['Connection timed out', 'Message expired'] }
55
- ],
56
- %r/\A4[.]7[.][568]\d\d\z/ => [
57
- { reason: 'securityerror', string: ['Access denied, please try again later'] }
58
- ],
59
- %r/\A5[.]1[.][07]\z/ => [
60
- { reason: 'rejected', string: ['Sender denied', 'Invalid address'] }
61
- ],
62
- %r/\A5[.]1[.][123]\z/ => [{
63
- reason: 'userunknown',
64
- string: [
65
- 'Bad destination mailbox address',
66
- 'Invalid X.400 address',
67
- 'Invalid recipient address',
68
- ]
69
- }],
70
- %r/\A5[.]4[.][46]\z/ => [{
71
- reason: 'networkerror',
72
- string: ['Invalid arguments', 'Routing loop detected'],
73
- }],
74
- %r/\A5[.]7[.][13]\z/ => [{
75
- reason: 'securityerror',
76
- string: ['Delivery not authorized', 'Not Authorized'],
77
- }],
78
- %r/\A5[.]7[.]50[1-3]\z/ => [{
79
- reason: 'spamdetected',
80
- string: ['Access denied, spam abuse detected', 'Access denied, banned sender'],
81
- }],
82
- %r/\A5[.]7[.]50[457]\z/ => [{
83
- reason: 'filtered',
84
- string: [
85
- 'Recipient address rejected: Access denied',
86
- 'Access denied, banned recipient',
87
- 'Access denied, rejected by recipient'
88
- ]
89
- }],
90
- %r/\A5[.]7[.]6\d\d\z/ => [
91
- { reason: 'blocked', string: ['Access denied, banned sending IP '] }
92
- ],
93
- %r/\A5[.]7[.]7\d\d\z/ => [
94
- { reason: 'toomanyconn', string: ['Access denied, tenant has exceeded threshold'] }
95
- ],
96
- }.freeze
97
12
  MessagesOf = {
98
- # Copied and converted from Sisimai::Lhost::Exchange2007
99
- 'expired' => ['QUEUE.Expired'],
100
- 'hostunknown' => ['SMTPSEND.DNS.NonExistentDomain'],
101
- 'mesgtoobig' => ['RESOLVER.RST.RecipSizeLimit', 'RESOLVER.RST.RecipientSizeLimit'],
102
- 'networkerror' => ['SMTPSEND.DNS.MxLoopback'],
103
- 'rejected' => ['RESOLVER.RST.NotAuthorized'],
104
- 'securityerror' => ['RESOLVER.RST.AuthRequired'],
105
- 'systemerror' => [
106
- 'RESOLVER.ADR.Ambiguous',
107
- 'RESOLVER.ADR.BadPrimary',
108
- 'RESOLVER.ADR.InvalidInSmtp',
109
- 'RESOLVER.FWD.NotFound',
110
- ],
111
- 'toomanyconn' => ['RESOLVER.ADR.RecipLimit', 'RESOLVER.ADR.RecipientLimit'],
112
- 'userunknown' => [
113
- 'RESOLVER.ADR.RecipNotFound',
114
- 'RESOLVER.ADR.RecipientNotFound',
115
- 'RESOLVER.ADR.ExRecipNotFound',
116
- 'RESOLVER.ADR.ExRecipientNotFound',
13
+ 'blocked' => [
14
+ # Exchange Server 2019 ----------------------------------------------------------------
15
+ # - Transient network issues or server problems that might eventually correct them-
16
+ # selves. The sending server will retry delivery of the message, and will generate
17
+ # further status reports. The message size limit for the connection has been reached,
18
+ # or the message submission rate for the source IP address has exceeded the configur-
19
+ # ed limit. For more information, see Message rate limits and throttling. Antispam,
20
+ # SMTP proxy, or firewall configuration issues are blocking email from the Exchange
21
+ # server.
22
+ ['4.4.2', 0, 0, 'connection dropped'],
23
+
24
+ # Exchange Online ---------------------------------------------------------------------
25
+ # - Suspicious activity has been detected on the IP in question, and it has been tempo-
26
+ # rarily restricted while it's being further evaluated.
27
+ # - If this activity is valid, this restriction will be lifted shortly.
28
+ ['4.7.', 850, 899, 'access denied, please try again later'],
29
+
30
+ # - Access denied, the sending IPv6 address [2a01:111:f200:2004::240] must have a re-
31
+ # verse DNS record
32
+ # - The sending IPv6 address must have a reverse DNS record in order to send email over
33
+ # IPv6.
34
+ ['5.7.25', 0, 0, 'must have a reverse dns record'],
35
+
36
+ # - Your server is attempting to introduce itself (HELO according to RFC 821) as the
37
+ # server it's trying to connect to, rather than its own fully qualified domain name.
38
+ # - This isn't allowed, and it's characteristic of typical spambot behavior.
39
+ ['5.7.506', 0, 0, 'access denied, bad helo'],
40
+
41
+ # - The IP that you're attempting to send from has been blocked by the recipient's or-
42
+ # ganization.
43
+ # - Contact the recipient in order to resolve this issue.
44
+ ['5.7.507', 0, 0, 'access denied, rejected by recipient'],
45
+
46
+ # - Access denied, [contoso.com] does not accept email over IPv6
47
+ # - The sender is attempting to transmit a message to the recipient over IPv6, but the
48
+ # recipient doesn't accept email messages over IPv6.
49
+ ['5.7.510', 0, 0, 'does not accept email over ipv6'],
50
+
51
+ # - The IP that you're attempting to send from has been banned.
52
+ # - To delist the address, email delist@messaging.microsoft.com and provide the full
53
+ # NDR code and IP address to delist. For more information, see Use the delist portal
54
+ # to remove yourself from the blocked senders list.
55
+ ['5.7.511', 0, 0, 'access denied, banned sender'],
56
+
57
+ # - Service unavailable, Client host [$ConnectingIP] blocked by $recipientDomain using
58
+ # Customer Block list (AS16012607)
59
+ # - The recipient domain has added your sending IP address to its custom blocklist.
60
+ # - The domain that received the email has blocked your sender's IP address. If you
61
+ # think your IP address has been added to the recipient domain's custom blocklist in
62
+ # error, you need to contact them directly and ask them to remove it from the block-
63
+ # list.
64
+ ['5.7.513', 0, 0, 'using customer block list'],
65
+
66
+ # - 5.7.606-649 Access denied, banned sending IP [IP1.IP2.IP3.IP4]
67
+ # - The IP that you're attempting to send from has been banned.
68
+ # - Verify that you're following the best practices for email deliverability, and en-
69
+ # sure your IPs' reputations haven't been degraded as a result of compromise or mali-
70
+ # cious traffic. If you believe you're receiving this message in error, you can use
71
+ # the self-service portal to request to be removed from this list.
72
+ # - For more information, see Use the delist portal to remove yourself from the blocked
73
+ # senders list.
74
+ ['5.7.', 606, 649, 'access denied, banned sending ip '],
75
+
76
+ # Previous versions of Exchange Server ------------------------------------------------
77
+ # - Suspicious activity has been detected and sending has been temporarily restricted
78
+ # for further evaluation.
79
+ # - If this activity is valid, this restriction will be lifted shortly.
80
+ ['4.7.', 500, 699, 'access denied, please try again later'],
81
+
82
+ # Previous versions of Exchange Server ------------------------------------------------
83
+ ['5.5.4', 0, 0, 'invalid domain name'],
84
+ ['5.7.51', 0, 0, 'restrictdomainstoipaddresses or restrictdomainstocertificate'],
85
+
86
+ # Undocumented error messages ---------------------------------------------------------
87
+ # - 550 5.7.1 Unfortunately, messages from [10.0.2.5] weren't sent. Please contact your
88
+ # Internet service provider since part of their network is on our block list (S3150).
89
+ ['5.7.1', 0, 0, 'part of their network is on our block list (s3150)'],
90
+
91
+ # - Access denied, a message sent over IPv6 [2a01:111:f200:2004::240] must pass either
92
+ # SPF or DKIM validation, this message is not signed
93
+ # - The sending message sent over IPv6 must pass either SPF or DKIM.
94
+ ['4.7.26', 0, 0, 'must pass either spf or dkim validation, this message is not signed'],
95
+
96
+ # - Records are DNSSEC authentic, but one or multiple of these scenarios occurred:
97
+ # - The destination mail server's certificate doesn't match with what is expected per
98
+ # the authentic TLSA record.
99
+ # - Authentic TLSA record is misconfigured.
100
+ # - Destination domain is being attacked.
101
+ # - Any other DANE failure.
102
+ # - This message usually indicates an issue on the destination email server. Check the
103
+ # validity of recipient address and determine if the destination server is configured
104
+ # correctly to receive messages.
105
+ # - For more information about DANE, see: https://datatracker.ietf.org/doc/html/rfc7671
106
+ ['4.7.323', 0, 0, 'tlsa-invalid: The domain failed dane validation'],
107
+ ['5.7.323', 0, 0, 'tlsa-invalid: The domain failed dane validation'],
108
+
109
+ # - The destination domain indicated it was DNSSEC-authentic, but Exchange Online was
110
+ # not able to verify it as DNSSEC-authentic.
111
+ ['4.7.324', 0, 0, 'dnssec-invalid: destination domain returned invalid dnssec records'],
112
+ ['5.7.324', 0, 0, 'dnssec-invalid: destination domain returned invalid dnssec records'],
113
+
114
+ # - This happens when the presented certificate identities (CN and SAN) of a destina-
115
+ # tion SMTP target host don't match any of the domains or MX host.
116
+ # - This message usually indicates an issue on the destination email server. Check the
117
+ # validity of recipient address and determine if the destination server is configured
118
+ # correctly to receive messages. For more information, see How SMTP DNS-based Authen-
119
+ # tication of Named Entities (DANE) works to secure email communications.
120
+ ['4.7.325', 0, 0, 'certificate-host-mismatch: remote certificate must have a common name or subject alternative name matching the hostname (dane)'],
121
+ ['5.7.325', 0, 0, 'certificate-host-mismatch: remote certificate must have a common name or subject alternative name matching the hostname (dane)'],
122
+
123
+ # - The destination email system uses SPF to validate inbound mail, and there's a prob-
124
+ # lem with your SPF configuration.
125
+ ['5.7.23', 0, 0, 'the message was rejected because of sender policy framework violation'],
126
+
127
+ # - DNSSEC checks have passed, yet upon establishing the connection the destination
128
+ # mail server provides a certificate that is expired.
129
+ # - A valid X.509 certificate that isn't expired must be presented. X.509 certificates
130
+ # must be renewed after their expiration, commonly annually.
131
+ ['5.7.322', 0, 0, "certificate-expired: destination mail server's certificate is expired"],
132
+
133
+ # - Access denied, sending domain [$SenderDomain] does not pass DMARC verification
134
+ # - The sender's domain in the 5322.From address doesn't pass DMARC.
135
+ ['5.7.509', 0, 0, 'does not pass dmarc verification'],
136
+ # Undocumented error messages ---------------------------------------------------------
137
+ # - status=deferred (host outlook-com.olc.protection.outlook.com[192.0.2.255] said:
138
+ # 451 4.7.650 The mail server [192.0.2.5] has been temporarily rate limited due to IP
139
+ # reputation. For e-mail delivery information, see https://postmaster.live.com (S775)
140
+ # [***.prod.protection.outlook.com] (in reply to MAIL FROM command))
141
+ ['4.7.650', 0, 0, 'has been temporarily rate limited due to ip reputation'],
142
+ ],
143
+ 'contenterror' => [
144
+ # Exchange Server 2019 ----------------------------------------------------------------
145
+ # - The message was determined to be malformed, and was moved to the poison message
146
+ # queue. For more information, see Types of queues.
147
+ ['5.3.0', 0, 0, 'too many related errors'],
148
+
149
+ # Exchange Online ---------------------------------------------------------------------
150
+ # - Your email program added invalid characters (bare line feed characters) into a mes-
151
+ # sage you sent.
152
+ ['5.6.11', 0, 0, 'invalid characters'],
153
+
154
+ # Previous versions of Exchange Server ------------------------------------------------
155
+ ['5.4.11', 0, 0, 'agent generated message depth exceeded'],
156
+ ['5.5.6', 0, 0, 'invalid message content'],
157
+ ],
158
+ 'exceedlimit' => [
159
+ # Exchange Server 2019 ----------------------------------------------------------------
160
+ # - The message is too large. Send the message again without any attachments, or confi-
161
+ # gure a larger message size limit for the recipient. For more information, see Re-
162
+ # cipient limits.
163
+ ['5.2.3', 0, 0, 'resolver.rst.recipsizelimit; message too large for this recipient'],
164
+ ],
165
+ 'expired' => [
166
+ # Exchange Server 2019 ----------------------------------------------------------------
167
+ # - Transient network issues that might eventually correct themselves. The Exchange
168
+ # server periodically tries to connect to the destination server to deliver the mes-
169
+ # sage. After multiple failures, the message is returned to the sender in an NDR with
170
+ # a permanent failure code.
171
+ # For more information about configuring the queue retry and failure intervals, see
172
+ # Configure message retry, resubmit, and expiration intervals. To manually retry a
173
+ # queue, see Retry queues. Firewall or Internet service provider (ISP) restrictions
174
+ # on TCP port 25.
175
+ ['4.4.1', 0, 0, 'connection timed out'],
176
+
177
+ # - Send connector configuration issues. For example:
178
+ # - The Send connector is configured to use DNS routing when it should be using smart
179
+ # host routing, or vice-versa. Use nslookup to verify that the destination domain
180
+ # is reachable from the Exchange server.
181
+ # - The FQDN that the Send connector provides to HELO or EHLO requests doesn't match
182
+ # the host name in your MX record (for example, mail.contoso.com). Some messaging
183
+ # systems are configured to compare these values in an effort to reduce spam. The
184
+ # default value on a Send connector is blank, which means the FQDN of the Exchange
185
+ # server is used (for example, exchange01.contoso.com).
186
+ # - The Mailbox Transport Delivery service isn't started on the destination server
187
+ # (which prevents the delivery of the message to the mailbox).
188
+ # - The destination messaging system has issues with Transport Neutral Encryption For-
189
+ # mat (TNEF) messages (also known as rich text format or RTF in Outlook). For exam-
190
+ # ple, meeting requests or messages with images embedded in the message body.
191
+ # - If the destination domain uses the Sender Policy Framework (SPF) to check message
192
+ # sources, there may be SPF issues with your domain (for example, your SPF record
193
+ # doesn't include all email sources for your domain).
194
+ ['4.4.7', 0, 0, 'message delayed'],
195
+ ['4.4.7', 0, 0, 'queue expired; message expired'],
196
+
197
+ # Exchange Online ---------------------------------------------------------------------
198
+ # - The message in the queue has expired. The sending server tried to relay or deliver
199
+ # the message, but the action wasn't completed before the message expiration time oc-
200
+ # curred. This message can also indicate that a message header limit has been reached
201
+ # on a remote server, or some other protocol time-out occurred while communicating
202
+ # with the remote server.
203
+ # - This message usually indicates an issue on the receiving server. Check the validity
204
+ # of the recipient address, and determine if the receiving server is configured cor-
205
+ # rectly to receive messages. You might have to reduce the number of recipients in
206
+ # the message header for the host about which you're receiving this error. If you
207
+ # send the message again, it's placed in the queue again. If the receiving server is
208
+ # available, the message is delivered.
209
+ ['4.4.7', 0, 0, 'message expired'],
210
+
211
+ # - The email took too long to be successfully delivered, either because the destina-
212
+ # tion server never responded or the sent message generated an NDR error and that NDR
213
+ # couldn't be delivered to the original sender.
214
+ ['5.4.300', 0, 0, 'message expired'],
215
+ ],
216
+ 'mailboxfull' => [
217
+ # Exchange Server 2019 ----------------------------------------------------------------
218
+ # - The recipient's mailbox has exceeded its storage quota and is no longer able to ac-
219
+ # cept new messages. For more information about configuring mailbox quotas, see Con-
220
+ # figure storage quotas for a mailbox.
221
+ ['5.2.2', 0, 0, 'mailbox full'],
222
+ ],
223
+ 'mesgtoobig' => [
224
+ # Exchange Server 2019 ----------------------------------------------------------------
225
+ # - The message is too large. This error can be generated by the source or destination
226
+ # messaging system. Send the message again without any attachments, or configure a
227
+ # larger message size limit. For more information, see Message size and recipient
228
+ # limits in Exchange Server.
229
+ ['5.3.4', 0, 0, 'message size exceeds fixed maximum message size'],
230
+
231
+ # Previous versions of Exchange Server ------------------------------------------------
232
+ ['5.3.4', 0, 0, 'message too big for system'],
233
+ ],
234
+ 'networkerror' => [
235
+ # Exchange Server 2019 ----------------------------------------------------------------
236
+ # - There's a DNS or network adapter configuration issue on the Exchange server. Verify
237
+ # the internal and external DNS lookup settings for the Exchange by running this com-
238
+ # mand in the Exchange Management Shell:
239
+ # - Get-TransportService | Format-List Name,ExternalDNS*,InternalDNS*;
240
+ # - Get-FrontEndTransportService | Format-List Name,ExternalDNS*,InternalDNS*`
241
+ # You can configure these settings by using the InternalDNS* and ExternalDNS* parame-
242
+ # ters on the Set-TransportService and Set-FrontEndTransportService cmdlets.
243
+ # By default, these settings are used by Send connectors (the default value of the
244
+ # UseExternalDNSServersEnabled parameter value is $false). Check the priority (order)
245
+ # of the network adapters in the operating system of the Exchange server.
246
+ ['5.4.4', 0, 0, 'smtpsend.dns.nonexistentdomain; nonexistent domain'],
247
+
248
+ # - A configuration error has caused an email loop. By default, after 20 iterations of
249
+ # an email loop, Exchange interrupts the loop and generates an NDR. Verify that Inbox
250
+ # rules for the recipient and sender, or forwarding rules on the recipient's mailbox
251
+ # aren't causing this (the message generates a message, which generates another mes-
252
+ # sage, and the process continues indefinitely).
253
+ # Verify the mailbox doesn't have a targetAddress property value in Active Directory
254
+ # (this property corresponds to the ExternalEmailAddress parameter for mail users in
255
+ # Exchange). If you remove Exchange servers, or modify settings related to mail rout-
256
+ # ing an mail flow, be sure to restart the Microsoft Exchange Transport and Exchange
257
+ # Frontend Transport services.
258
+ ['5.4.6', 0, 0, 'hop count exceeded - possible mail loop'],
259
+
260
+ # Exchange Online ---------------------------------------------------------------------
261
+ # - Microsoft 365 or Office 365 is trying to send a message to an email server outside
262
+ # of Microsoft 365 or Office 365, but attempts to connect to it are failing due to a
263
+ # network connection issue at the external server's location.
264
+ # - This error almost always indicates an issue with the receiving server or network
265
+ # outside of Microsoft 365 or Office 365. The error should also include the IP ad-
266
+ # dress of the server or service that's generating the error, which you can use to
267
+ # identify the party responsible for fixing this.
268
+ ['4.4.316', 0, 0, 'connection refused'], # [Message=Socket error code 10061]
269
+
270
+ # - A configuration error has caused an email loop. 5.4.6 is generated by on-premises
271
+ # Exchange server (you'll see this code in hybrid environments). 5.4.14 is generated
272
+ # by Exchange Online. By default, after 20 iterations of an email loop, Exchange in-
273
+ # terrupts the loop and generates an NDR to the sender of the message.
274
+ # - This error occurs when the delivery of a message generates another message in re-
275
+ # sponse. That message then generates a third message, and the process is repeated,
276
+ # creating a loop. To help protect against exhausting system resources, Exchange in-
277
+ # terrupts the mail loop after 20 iterations. Mail loops are typically created be-
278
+ # cause of a configuration error on the sending mail server, the receiving mail serv-
279
+ # er, or both. Check the sender's and the recipient's mailbox rules configuration to
280
+ # determine whether automatic message forwarding is enabled.
281
+ ['5.4.4', 0, 0, 'invalid arguments'],
282
+ ['5.4.6', 0, 0, 'routing loop detected'],
283
+ ['5.4.14', 0, 0, 'routing loop detected'],
284
+ ],
285
+ 'norelaying' => [
286
+ # Exchange Server 2019 ----------------------------------------------------------------
287
+ # - You have an application server or device that's trying to relay messages through
288
+ # Exchange. For more information, see Allow anonymous relay on Exchange servers. The
289
+ # recipient is configured to only accept messages from authenticated (typically, in-
290
+ # ternal) senders. For more information, see Configure message delivery restrictions
291
+ # for a mailbox.
292
+ ['5.7.1', 0, 0, 'unable to relay'],
293
+ ['5.7.1', 0, 0, 'client was not authenticated'],
294
+
295
+ # Exchange Online ---------------------------------------------------------------------
296
+ # - The mail server that's generating the error doesn't accept mail for the recipient's
297
+ # domain. This error is caused by mail server or DNS misconfiguration.
298
+ ['5.4.1', 0, 0, 'relay access denied'],
299
+
300
+ # - The sending email system isn't allowed to send a message to an email system where
301
+ # that email system isn't the final destination of the message.
302
+ # - This error occurs when the sending email system tries to send an anonymous message
303
+ # to a receiving email system, and the receiving email system doesn't accept messages
304
+ # for the domain or domains specified in one or more of the recipients. The following
305
+ # are the most common reasons for this error:
306
+ # - A third party tries to use a receiving email system to send spam, and the receiv-
307
+ # ing email system rejects the attempt. By the nature of spam, the sender's email
308
+ # address might have been forged, and the resulting NDR could have been sent to the
309
+ # unsuspecting sender's email address. It's difficult to avoid this situation.
310
+ # - An MX record for a domain points to a receiving email system where that domain is
311
+ # not accepted. The administrator responsible for the specific domain name must
312
+ # correct the MX record or configure the receiving email system to accept messages
313
+ # sent to that domain, or both.
314
+ # - A sending email system or client that should use the receiving email system to
315
+ # relay messages doesn't have the correct permissions to do this.
316
+ ['5.7.1', 0, 0, 'unable to relay'],
317
+
318
+ # - You use an inbound connector to receive messages from your on-premises email envi-
319
+ # ronment, and something has changed in your on-premises environment that makes the
320
+ # inbound connector's configuration incorrect.
321
+ ['5.7.64', 0, 0, 'tenantattribution; relay access denied'],
322
+
323
+ # Previous versions of Exchange Server ------------------------------------------------
324
+ ['5.4.310', 0, 0, 'does not exist'], # DNS domain * does not exist
325
+ ],
326
+ 'notaccept' => [
327
+ ['4.3.2', 0, 0, 'system not accepting network messages'],
328
+
329
+ # Exchange Server 2019 ----------------------------------------------------------------
330
+ # - You're using the ABP Routing agent, and the recipient isn't a member of the global
331
+ # address list that's specified in their address book policy (ABP). For more infor-
332
+ # mation, see Use the Exchange Management Shell to install and configure the Address
333
+ # Book Policy Routing Agent and Address book policies in Exchange Server.
334
+ ['5.3.2', 0, 0, 'storedrv.deliver: missing or bad storedriver mdb properties'],
335
+ ],
336
+ 'policyviolation' => [
337
+ # - 5.0.350 is a generic catch-all error code for a wide variety of non-specific errors
338
+ # lfrom the recipient's email organization. The specific x-dg-ref header is too long
339
+ # message is related to Rich Text formatted messages. The specific Requested action
340
+ # not taken: policy violation detected (AS345) message is related to nested attach-
341
+ # ments.
342
+ ['5.0.350', 0, 0, 'x-dg-ref header is too long'],
343
+ ['5.0.350', 0, 0, 'requested action not taken: policy violation detected (as345)'],
344
+
345
+ # - The message was rejected by a mail flow rule (also known as a transport rule). This
346
+ # enhanced status code range is available when the rule is configured to reject mes-
347
+ # sages (otherwise, the default code that's used is 5.7.1). For more information, see
348
+ # Mail flow rule actions in Exchange Server.
349
+ ['5.7.', 900, 999, 'delivery not authorized, message refused'],
350
+ ],
351
+ 'rejected' => [
352
+ # Exchange Server 2019 ----------------------------------------------------------------
353
+ # - There's a problem with the sender's email address. Verify the sender's email ad-
354
+ # dress.
355
+ ['5.1.7', 0, 0, 'invalid address'],
356
+ ['5.1.7', 0, 0, 'unknown sender address'],
357
+
358
+ # - A common cause of this NDR is when you use Microsoft Outlook to save an email mes-
359
+ # sage as a file, and then someone opened the message offline and replied to it. The
360
+ # message property only preserves the legacyExchangeDN attribute when Outlook deliv-
361
+ # ers the message, and therefore the lookup could fail.
362
+ # - Either the recipient address is incorrectly formatted, or the recipient couldn't be
363
+ # correctly resolved. The first step in resolving this error is to check the recipi-
364
+ # ent address, and send the message again.
365
+ ['5.1.0', 0, 0, 'sender denied'],
366
+
367
+ # - The account has been blocked for sending too much spam. Typically, this problem oc-
368
+ # curs because the account has been compromised (hacked) by phishing or malware.
369
+ ['5.1.8', 0, 0, 'access denied, bad outbound sender'],
370
+
371
+ # Exchange Online ---------------------------------------------------------------------
372
+ # - The sender of the message isn't allowed to send messages to the recipient.
373
+ # - This error occurs when the sender tries to send a message to a recipient but the
374
+ # sender isn't authorized to do this. This frequently occurs when a sender tries to
375
+ # send messages to a distribution group that has been configured to accept messages
376
+ # only from members of that distribution group or other authorized senders. The send-
377
+ # er must request permission to send messages to the recipient. This error can also
378
+ # occur if an Exchange transport rule rejects a message because the message matched
379
+ # conditions that are configured on the transport rule.
380
+ ['5.7.1', 0, 0, 'delivery not authorized'],
381
+
382
+ # - The sender's message is rejected because the recipient address is set up to reject
383
+ # messages sent from outside of its organization. Only an email admin for the recipi-
384
+ # ent's organization can change this.
385
+ ['5.7.12', 0, 0, 'sender was not authenticated by organization'],
386
+
387
+ # - The sender doesn't have permission to send to the distribution group because the
388
+ # sender isn't in the group's allowed-senders list. Depending how the group is set
389
+ # up, even the group's owner might need to be added to the allowed sender list in or-
390
+ # der to send messages to the group.
391
+ ['5.7.124', 0, 0, 'sender not in allowed-senders list'],
392
+
393
+ # - The recipient address is a group distribution list that is set up to reject mes-
394
+ # sages sent from outside of its organization. Only an email admin for the recipi-
395
+ # ent's organization or the group owner can change this.
396
+ ['5.7.133', 0, 0, 'sender not authenticated for group'],
397
+
398
+ # - The recipient address is a mailbox that is set up to reject messages sent from out-
399
+ # side of its organization. Only an email admin for the recipient's organization can
400
+ # change this.
401
+ ['5.7.134', 0, 0, 'sender was not authenticated for mailbox'],
402
+
403
+ # - The recipient address is a public folder that is set up to reject messages sent
404
+ # from outside of its organization. Only an email admin for the recipient's organiza-
405
+ # tion can change this.
406
+ ['5.7.13', 0, 0, 'sender was not authenticated for public folder'],
407
+ ['5.7.135', 0, 0, 'sender was not authenticated for public folder'],
408
+
409
+ # - The recipient address is a mail user that is set up to reject messages sent from
410
+ # outside of its organization. Only an email admin for the recipient's organization
411
+ # can change this.
412
+ ['5.7.136', 0, 0, 'sender was not authenticated'],
413
+
414
+ # - The sending account has been banned due to detected spam activity.
415
+ # - For details, see Fix email delivery issues for error code 451 5.7.500-699 (ASxxx)
416
+ # in Exchange Online.
417
+ # - Verify that any account issues have been resolved, and reset its credentials. To
418
+ # restore this account's ability to send mail, contact support through your regular
419
+ # channel.
420
+ ['5.7.', 501, 503, 'access denied, spam abuse detected'],
421
+
422
+ # - Message was sent without a valid "From" email address.
423
+ # - Office 365 only. Each message must contain a valid email address in the "From"
424
+ # header field. Proper formatting of this address includes angle brackets around the
425
+ # email address, for example, <security@contoso.com>. Without this address Microsoft
426
+ # 365 or Office 365 will reject the message.
427
+ ['5.7.512', 0, 0, 'access denied, message must be rfc 5322 section 3.6.2 compliant'],
428
+
429
+ # - A suspicious number of messages from unprovisioned domains is coming from this ten-
430
+ # ant.
431
+ # - Add and validate any and all domains that you use to send email from Microsoft 365
432
+ # or Office 365. For more information, see Fix email delivery issues for error codes
433
+ # 5.7.700 through 5.7.750 in Exchange Online.
434
+ ['5.7.750', 0, 0, 'service unavailable. client blocked from sending from unregistered domains'],
435
+
436
+ # Previous versions of Exchange Server ------------------------------------------------
437
+ ['5.7.', 501, 503, 'access denied, banned sender'],
438
+ ],
439
+ 'securityerror' => [
440
+ # Exchange Server 2019 ----------------------------------------------------------------
441
+ # - A firewall or other device is blocking the Extended SMTP command that's required
442
+ # for Exchange Server authentication (X-EXPS). Internal email traffic is flowing
443
+ # through connectors that aren't configured to use the Exchange Server authentication
444
+ # method . Verify the remote IP address ranges on any custom Receive connectors.
445
+ ['5.7.3', 0, 0, 'cannot achieve exchange server authentication'],
446
+ ['5.7.3', 0, 0, 'not authorized'],
447
+
448
+ # Exchange Online ---------------------------------------------------------------------
449
+ # - DNSSEC checks have passed, yet upon connection, destination mail server doesn't re-
450
+ # spond to the STARTTLS command. The destination server responds to the STARTTLS com-
451
+ # mand, but the TLS handshake fails.
452
+ # - This message usually indicates an issue on the destination email server. Check the
453
+ # validity of the recipient address. Determine if the destination server is configur-
454
+ # ed correctly to receive the messages.
455
+ ['4.7.321', 0, 0, 'starttls-not-supported: destination mail server must support tls to receive mail'],
456
+ ['5.7.321', 0, 0, 'starttls-not-supported: destination mail server must support tls to receive mail'],
457
+
458
+ # - The sending email system didn't authenticate with the receiving email system. The
459
+ # receiving email system requires authentication before message submission.
460
+ # - This error occurs when the receiving server must be authenticated before message
461
+ # submission, and the sending email system hasn't authenticated with the receiving e-
462
+ # mail system. The sending email system administrator must configure the sending e-
463
+ # mail system to authenticate with the receiving email system for delivery to be suc-
464
+ # cessful.
465
+ ['5.7.1', 0, 0, 'client was not authenticated'],
466
+
467
+ # - You configured an application or device to send (relay) email messages in Microsoft
468
+ # 365 or Office 365 using the smtp.office365.com endpoint, and there's a problem with
469
+ # the configuration of the application or device.
470
+ ['5.7.57', 0, 0, 'client was not authenticated to send anonymous mail during mail from'],
471
+ ],
472
+ 'spamdetected' => [
473
+ # Exchange Server 2019 ----------------------------------------------------------------
474
+ # - The message was quarantined by content filtering. To configure exceptions to con-
475
+ # tent filtering, see Use the Exchange Management Shell to configure recipient and
476
+ # sender exceptions for content filtering.
477
+ ['5.2.1', 0, 0, 'content filter agent quarantined this message'],
478
+ ],
479
+ 'speeding' => [
480
+ ],
481
+ 'suspend' => [
482
+ # Exchange Online ---------------------------------------------------------------------
483
+ # - The recipient address that you're attempting to contact isn't valid.
484
+ # - Verify the recipient's email address, and try again.
485
+ # - If you feel this is in error, contact support.
486
+ ['5.7.504', 0, 0, 'recipient address rejected: access denied'],
487
+ ['5.7.505', 0, 0, 'access denied, banned recipient'],
488
+
489
+ # Previous versions of Exchange Server ------------------------------------------------
490
+ ['5.2.1', 0, 0, 'mailbox cannot be accessed'],
491
+ ],
492
+ 'syntaxerror' => [
493
+ # Exchange Server 2019 ----------------------------------------------------------------
494
+ # - Receive connectors that are used for internal mail flow are missing the required
495
+ # Exchange Server authentication mechanism. For more information about authentication
496
+ # on Receive connectors, see Receive connector authentication mechanisms.
497
+ ['5.3.3', 0, 0, 'unrecognized command'],
498
+
499
+ # - SMTP commands are sent out of sequence (for example, a server sends an SMTP command
500
+ # like AUTH or MAIL FROM before identifying itself with the EHLO command). After es-
501
+ # tablishing a connection to a messaging server, the first SMTP command must always
502
+ # be EHLO or HELO.
503
+ ['5.5.2', 0, 0, 'send hello first'],
504
+ ],
505
+ 'systemerror' => [
506
+ # Exchange Server 2019 ----------------------------------------------------------------
507
+ # - You've configured a custom Receive connector in the Transport (Hub) service on a
508
+ # Mailbox server that listens on port 25. Typically, custom Receive connectors that
509
+ # listen on port 25 belong in the Front End Transport service on the Mailbox server.
510
+ # Important Exchange server components are inactive. You can confirm this by running
511
+ # the following command in the Exchange Management Shell:
512
+ # Get-ServerComponent -Identity <ServerName>.
513
+ # To restart all inactive components, run the following command:
514
+ # Set-ServerComponentState -Identity <ServerName> -Component ServerWideOffline
515
+ # -State Active -Requester Maintenance.
516
+ # Incompatible transport agents (in particular, after an Exchange update). After you
517
+ # identify the transport agent, disable it or uninstall it. For more information, see
518
+ # Troubleshoot transport agents.
519
+ ['4.3.2', 0, 0, 'service not available'],
520
+ ['4.3.2', 0, 0, 'service not active'],
521
+
522
+ # - A mail loop was detected. Verify that the FQDN property on the Receive connector
523
+ # doesn't match the FQDN of another server, service, or device that's used in mail
524
+ # flow in your organization (by default, the Receive connector uses the FQDN of the
525
+ # Exchange server).
526
+ ['5.3.5', 0, 0, 'system incorrectly configured'],
527
+
528
+ # Exchange Online ---------------------------------------------------------------------
529
+ # - Journaling on-premises messages to Microsoft 365 or Office 365 isn't supported for
530
+ # this organization because they haven't turned on Journaling Archive in their set-
531
+ # tings.
532
+ # - A journaling rule is configured in the organization's on-premises environment to
533
+ # journal on-premises messages to Microsoft 365 or Office 365, but Journaling Archive
534
+ # is disabled. For this scenario to work, the organization's Office 365 administrator
535
+ # should either enable Journaling Archive or change the journaling rule to journal
536
+ # messages to a different location.
537
+ ['5.3.190', 0, 0, 'journaling on-premises messages to microsoft 365 or office 365 not supported when journaling archive is disabled'],
538
+
539
+ # Previous versions of Exchange Server ------------------------------------------------
540
+ ['5.0.0', 0, 0, 'helo / ehlo requires domain address'],
541
+ ['5.1.4', 0, 0, 'destination mailbox address ambiguous'],
542
+ ['5.2.4', 0, 0, 'mailing list expansion problem'],
543
+ ['5.2.14', 0, 0, 'misconfigured forwarding address'],
544
+
545
+ # Undocumented error messages ---------------------------------------------------------
546
+ ['4.4.3', 0, 0, 'temporary server error. please try again later attr18'],
547
+ ['4.7.0', 0, 0, 'temporary server error. please try again later. prx4 nexthop:'],
548
+ ['4.4.24', 0, 0, 'message failed to be replicated: insufficient system resource:'],
549
+ ['4.4.25', 0, 0, 'message failed to be replicated: no healthy secondary server available to accept replica at this time.'],
550
+ ['4.4.28', 0, 0, 'message failed to be replicated: the operation was canceled'],
551
+
552
+ # - status=deferred (host hotmail-com.olc.protection.outlook.com[192.0.2.1] said:
553
+ # 451 4.7.500 Server busy. Please try again later from [192.0.2.2]. (AS761) (in reply
554
+ # to RCPT TO command))
555
+ ['4.7.500', 0, 0, 'server busy. please try again later from '],
556
+
557
+ # - status=deferred (host apc.olc.protection.outlook.com[192.0.2.1] said:
558
+ # 451 4.7.700 PFA agent busy, please try again. [***.***.prod.protection.outlook.com]
559
+ # (in reply to MAIL FROM command))
560
+ ['4.7.700', 0, 0, 'pfa agent busy, please try again.'],
561
+ ],
562
+ 'systemfull' => [
563
+ # Exchange Server 2019 ----------------------------------------------------------------
564
+ # - Free disk space is low (for example, the disk that holds the queue database doesn't
565
+ # have the required amount of free space). For more information, see Understanding
566
+ # back pressure. To move the queue database to a different disk, see Change the loca-
567
+ # tion of the queue database.
568
+ # - Available memory is low (for example, Exchange installed on a virtual machine that
569
+ # is configured to use dynamic memory). Always use static memory on Exchange virtual
570
+ # machines.
571
+ ['4.3.1', 0, 0, 'insufficient system resources'],
572
+ ],
573
+ 'toomanyconn' => [
574
+ # Exchange Server 2019 ----------------------------------------------------------------
575
+ # - The combined total of recipients on the To, Cc, and Bcc lines of the message ex-
576
+ # ceeds the total number of recipients allowed in a single message for the organiza-
577
+ # tion, Receive connector, or sender. For more information, see Message size and re-
578
+ # cipient limits in Exchange Server.
579
+ ['5.5.3', 0, 0, 'too many recipients'],
580
+
581
+ # Exchange Online ---------------------------------------------------------------------
582
+ # - The message has more than 200 SMTP envelope recipients from the same domain.
583
+ # - An envelope recipient is the original, unexpanded recipient that's used in the RCPT
584
+ # TO command to transmit the message between SMTP servers. When this error is return-
585
+ # ed by Microsoft 365 or Office 365, the sending server must break up the number of
586
+ # envelope recipients into smaller chunks (chunking) and resend the message.
587
+ ['4.5.3', 0, 0, 'too many recipients'],
588
+
589
+ # Previous versions of Exchange Server ------------------------------------------------
590
+ ['5.2.122', 0, 0, 'the recipient has exceeded their limit for'],
591
+
592
+ # Exchange Online ---------------------------------------------------------------------
593
+ # - The recipient mailbox's ability to accept messages is being throttled because it's
594
+ # receiving too many messages too quickly. This is done so a single recipient's mail
595
+ # processing doesn't unfairly impact other recipients sharing the same mailbox data-
596
+ # base.
597
+ ['4.3.2', 0, 0, 'storedrv.deliver; recipient thread limit exceeded'],
598
+
599
+ # - The sender has exceeded the recipient rate limit as described in Sending limits.
600
+ # - This could indicate the account has been compromised and is being used to send
601
+ # spam.
602
+ ['5.1.90', 0, 0, "your message can't be sent because you've reached your daily limit for message recipients"],
603
+
604
+ # - The sender has exceeded the recipient rate limit or the message rate limit as de-
605
+ # scribed in Sending limits.
606
+ # - This could indicate the account has been compromised and is being used to send
607
+ # spam.
608
+ ['5.2.2', 0, 0, 'submission quota exceeded'],
609
+
610
+ # - The sender has exceeded the maximum number of messages they're allowed to send per
611
+ # hour to a specific recipient in Exchange Online.
612
+ # - The automated mailer or sender should try again later, and reduce the number of
613
+ # messages they send per hour to a specific recipient. This limit helps protect
614
+ # Microsoft 365 or Office 365 users from rapidly filling their inboxes with a large
615
+ # number of messages from errant automated notification systems or other single-send-
616
+ # er mail storms.
617
+ ['5.2.121', 0, 0, "recipient's per hour message receive limit from specific sender exceeded"],
618
+
619
+ # - The Microsoft 365 or Office 365 recipient has exceeded the number of messages they
620
+ # can receive per hour from all senders.
621
+ # - The automated mailer or sender should try again later, and reduce the number of
622
+ # messages they send per hour to a specific recipient. This limit helps protect
623
+ # Microsoft 365 and Office 365 users from rapidly filling their inboxes with a large
624
+ # number of messages from errant automated notification systems or other mail storms.
625
+ ['5.2.122', 0, 0, "recipient's per hour message receive limit exceeded"],
626
+
627
+ # - Access denied, [$SenderIPAddress] has exceeded permitted limits within $range range
628
+ # - The sender's IPv6 range has attempted to send too many messages in too short a time
629
+ # period.
630
+ ['5.7.508', 0, 0, 'has exceeded permitted limits within'],
631
+
632
+ # - The majority of traffic from this tenant has been detected as suspicious and has
633
+ # resulted in a ban on sending ability for the tenant.
634
+ # - Ensure that any compromises or open relays have been resolved, and then contact
635
+ # support through your regular channel. For more information, see Fix email delivery
636
+ # issues for error codes 5.7.700 through 5.7.750 in Exchange Online.
637
+ ['5.7.', 700, 749, 'access denied, tenant has exceeded threshold'],
638
+ ['5.7.', 700, 749, 'access denied, traffic not accepted from this ip'],
639
+ ],
640
+ 'userunknown' => [
641
+ # Exchange Server 2019 ----------------------------------------------------------------
642
+ # - The recipient's email address is incorrect (the recipient doesn't exist in the des-
643
+ # tination messaging system). Verify the recipient's email address. You recreated a
644
+ # deleted mailbox, and internal users are addressing email messages in Outlook or
645
+ # Outlook on the web using old entries in their autocomplete cache (the X.500 values
646
+ # or LegacyExchangeDN values for the recipient are now different). Tell users to de-
647
+ # lete the entry from their autocomplete cache and select the recipient again.
648
+ ['5.1.1', 0, 0, 'resolver.adr.exrecipnotfound; not found'],
649
+ ['5.1.1', 0, 0, 'user unknown'],
650
+
651
+ # - The recipient's email address is incorrect (for example, it contains unsupported
652
+ # characters or invalid formatting).
653
+ ['5.1.3', 0, 0, 'storedrv.submit; invalid recipient address'],
654
+
655
+ # - Receive connectors reject SMTP connections that contain the top level domains de-
656
+ # fined in RFC 2606 (.test, .example, .invalid, or .localhost), This behavior is con-
657
+ # trolled by the RejectReservedTopLevelRecipientDomains parameter on the New-Receive-
658
+ # Connector and Set-ReceiveConnector cmdlets.
659
+ ['5.1.', 4, 5, 'recipient address reserved by rfc 2606'],
660
+
661
+ # - Receive connectors reject SMTP connections that contain single label domains (for
662
+ # example, chris@contoso instead of chris@contoso.com) This behavior is controlled by
663
+ # the RejectSingleLabelRecipientDomains parameter on the New-ReceiveConnector and
664
+ # Set-ReceiveConnector cmdlets.
665
+ ['5.1.6', 0, 0, 'recipient addresses in single label domains not accepted'],
666
+
667
+ # Exchange Online ---------------------------------------------------------------------
668
+ # - This failure might be caused by the following conditions:
669
+ # - The recipient's email address was entered incorrectly by the sender.
670
+ # - No recipient's exists in the destination email system.
671
+ # - The recipient's mailbox has been moved and the Outlook recipient cache on the
672
+ # sender's computer hasn't updated.
673
+ # - An invalid legacy domain name (DN) exists for the recipient's mailbox Active Di-
674
+ # rectory Domain Service.
675
+ # - This error typically occurs when the sender of the message incorrectly enters the
676
+ # email address of the recipient. The sender should check the recipient's email ad-
677
+ # dress and send again. This error can also occur if the recipient email address was
678
+ # correct in the past but has changed or has been removed from the destination email
679
+ # system. If the sender of the message is in the same organization as the recipient,
680
+ # and the recipient's mailbox still exists, determine whether the recipient's mailbox
681
+ # has been relocated to a new email server. If this is the case, Outlook might not
682
+ # have updated the recipient cache correctly. Instruct the sender to remove the re-
683
+ # cipient's address from sender's Outlook recipient cache and then create a new mes-
684
+ # sage. Resending the original message will result in the same failure.
685
+ ['5.1.1', 0, 0, 'bad destination mailbox address'],
686
+
687
+ # - The recipient's <SMTP Address> wasn't found by SMTP address lookup.
688
+ ['5.1.10', 0, 0, 'recipient not found'],
689
+
690
+ # - The recipient's address doesn't exist.
691
+ ['5.4.1', 0, 0, 'recipient address rejected: access denied'],
692
+
693
+ # - The recipient's <SMTP Address> domain is @hotmail.com or @outlook.com and it wasn't
694
+ # found by SMTP address lookup.
695
+ # - Similar to 550 5.1.10.
696
+ ['5.5.0', 0, 0, 'requested action not taken: mailbox unavailable'],
697
+
698
+ # Previous versions of Exchange Server ------------------------------------------------
699
+ ['5.1.2', 0, 0, 'invalid x.400 address'],
117
700
  ],
118
701
  }.freeze
119
702
 
@@ -122,51 +705,37 @@ module Sisimai
122
705
  # @return [String] The bounce reason for Exchange Online
123
706
  def get(argvs)
124
707
  return argvs.reason unless argvs.reason.empty?
708
+ return '' if argvs.diagnosticcode.empty?
709
+ return '' if argvs.deliverystatus.empty?
710
+ return '' unless argvs.deliverystatus =~ /\A[245][.]\d[.]\d+\z/
125
711
 
126
712
  statuscode = argvs.deliverystatus
127
- statusmesg = argvs.diagnosticcode
713
+ esmtperror = argvs.diagnosticcode.downcase
714
+ thirddigit = statuscode.split('.')[-1].to_i
128
715
  reasontext = ''
129
716
 
130
- StatusList.each_key do |e|
131
- # Try to compare with each status code as a key
132
- next unless statuscode == e
133
- StatusList[e].each do |f|
134
- # Try to compare with each string of error messages
135
- next unless statusmesg.include?(f[:string])
136
- reasontext = f[:reason]
137
- break
138
- end
139
- break unless reasontext.empty?
140
- end
141
- return reasontext unless reasontext.empty?
142
-
143
- ReStatuses.each_key do |e|
144
- # Try to compare with each string of delivery status codes
145
- next unless statuscode =~ e
146
- ReStatuses[e].each do |f|
147
- # Try to compare with each string of error messages
148
- f[:string].each do |g|
149
- next unless statusmesg.include?(g)
150
- reasontext = f[:reason]
151
- break
152
- end
153
- break unless reasontext.empty?
154
- end
155
- break unless reasontext.empty?
156
- end
157
- return reasontext unless reasontext.empty?
158
-
159
- # D.S.N. included in the error message did not matched with any
160
- # key in ReStatuses
161
717
  MessagesOf.each_key do |e|
162
- # Try to compare with error messages defined in MessagesOf
718
+ # Each key is a reason name
163
719
  MessagesOf[e].each do |f|
164
- next unless statusmesg.include?(f)
720
+ # ["status-code", min, max, "error message"]
721
+ if f[1] == f[2]
722
+ # This error code have no range
723
+ next unless statuscode == f[0]
724
+ else
725
+ # This error code has a range
726
+ next unless statuscode.start_with?(f[0])
727
+ next if thirddigit < f[1]
728
+ next if thirddigit > f[2]
729
+ end
730
+
731
+ next unless esmtperror.include?(f[3])
165
732
  reasontext = e
166
733
  break
167
734
  end
168
735
  break unless reasontext.empty?
169
736
  end
737
+
738
+
170
739
  return reasontext
171
740
  end
172
741