Sisimai/Rhost/Google.pm

filter: Statementstmt 100% 28 / 28 Branchbran 91.6% 11 / 12 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.8% 46 / 48 CC 10 SCAR 20.7
CC
10
Cov
98%
find
10.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.9
« Sisimai/Fact/YAML.pm ↑ Summary Sisimai/String.pm »
1 package Sisimai::Rhost::Google;
2 9 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 134 ▶sub find {
Subroutine find: called CC=10 SCAR=23.0
Pod undocumented
7 # Detect bounce reason from Google Workspace
8 # @param [Sisimai::Fact] argvs Decoded email object
9 # @return [String] The bounce reason for Google Workspace
10 # @see https://support.google.com/a/answer/3726730?hl=en
11 # @since v4.0.0
12 134 my $class = shift;
13 134 ▶ my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'};
Branch: 1 branch
BranchTrueFalseTotal
unless $argvs->{"diagnosticcode"} 1 132 133
Condition100%2/2
shift() // (return "")
l!l
1331
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
14 132 ▶ return '' unless Sisimai::SMTP::Reply->test($argvs->{'replycode'});
Branch: 1 branch
BranchTrueFalseTotal
unless "Sisimai::SMTP::Reply"->test($argvs->{"replycode"}) 2 130 132
15 130 ▶ return '' unless Sisimai::SMTP::Status->test($argvs->{'deliverystatus'});
Branch: 1 branch
BranchTrueFalseTotal
unless "Sisimai::SMTP::Status"->test($argvs->{"deliverystatus"}) 0 130 130
16  
17 130 require Sisimai::Eb;
18 130 state $messagesof = {
19 $Sisimai::Eb::ReAUTH => [
20 # - 451 4.7.24 The SPF record of the sending domain has one or more suspicious entries.
21 # To protect our users from spam, mail sent from your IP address has been temporarily
22 # rate limited. For more information, go to Email sender guidelines.
23 # https://support.google.com/mail/answer/81126#authentication
24 #
25 # - 550 5.7.24 The SPF record of the sending domain has one or more suspicious entries.
26 # For more information, go to Email sender guidelines.
27 # - https://support.google.com/mail/answer/81126#authentication
28 ['451', '4.7.24', 'the spf record of the sending domain'],
29 ['550', '5.7.24', 'the spf record of the sending domain'],
30  
31 # - 421 4.7.26 This mail has been rate limited because it is unauthenticated.
32 # Gmail requires all senders to authenticate with either SPF or DKIM.
33 # Authentication results: DKIM = did not pass SPF domain-name with ip: ip-address =
34 # did not pass. To resolve this issue, go to Email sender guidelines.
35 # - https://support.google.com/mail/answer/81126#authentication
36 ['421', '4.7.26', 'senders to authenticate with either spf or dkim'],
37 ['550', '5.7.26', 'senders to authenticate with either spf or dkim'],
38  
39 # - 550 5.7.26 This message fails to pass SPF checks for an SPF record with a hard fail
40 # policy (-all). To best protect our users from spam and phishing, the message has
41 # been blocked. Please visit https://support.google.com/mail/answer/81126 for more
42 # information.
43 #
44 # - 550 5.7.26 The MAIL FROM domain [domain-name] has an SPF record with a hard fail
45 # policy (-all) but it fails to pass SPF checks with the ip: [ip-address]. To best
46 # protect our users from spam and phishing, the message has been blocked. For more
47 # information, go to Email sender guidelines.
48 # - https://support.google.com/mail/answer/81126#authentication
49 ['550', '5.7.26', 'fails to pass spf checks for an spf record with a hard fail'],
50 ['550', '5.7.26', 'has an spf record with a hard fail policy'],
51  
52 # - 451 4.7.26 Unauthenticated email from domain-name is not accepted due to domain's
53 # DMARC policy, but temporary DNS failures prevent authentication. Please contact the
54 # administrator of domain-name domain if this was a legitimate mail. To learn about
55 # the DMARC initiative, go to https://support.google.com/mail/?p=DmarcRejection
56 ['451', '4.7.26', "is not accepted due to domain's dmarc policy"],
57 ['550', '5.7.26', "is not accepted due to domain's dmarc policy"],
58  
59 # - 550 5.7.26 Unauthenticated email from domain-name is not accepted due to domain's
60 # DMARC policy. Please contact the administrator of domain-name domain. If this was
61 # a legitimate mail please visit [Control unauthenticated mail from your domain] to
62 # learn about the DMARC initiative. If the messages are valid and aren't spam, con-
63 # tact the administrator of the receiving mail server to determine why your outgoing
64 # messages don't pass authentication checks.
65 ['550', '5.7.26', "is not accepted due to domain's dmarc policy"],
66  
67 # - 550 5.7.26 This message does not have authentication information or fails to pass
68 # authentication checks (SPF or DKIM). To best protect our users from spam, the mes-
69 # sage has been blocked. Please visit https://support.google.com/mail/answer/81126
70 # for more information.
71 ['550', '5.7.1', 'fails to pass authentication checks'],
72 ['550', '5.7.26', 'fails to pass authentication checks'],
73  
74 # - 421 4.7.27 Your email has been rate limited because SPF authentication didn't pass
75 # for this message. Gmail requires all bulk email senders to authenticate their emaili
76 # with SPF. Authentication results: SPF domain-name with IP address: ip-address = Did
77 # not pass.
78 ['421', '4.7.27', 'senders to authenticate with spf'],
79 ['421', '4.7.27', 'senders to authenticate their email with spf'],
80 ['550', '5.7.27', 'senders to authenticate with spf'],
81  
82 # - 421 4.7.30 Your email has been rate limited because DKIM authentication didn't pass
83 # for this message. Gmail requires all email bulk senders to authenticate their email
84 # with DKIM. Authentication results: DKIM = Did not pass.
85 ['421', '4.7.30', 'senders to authenticate their email with dkim'],
86  
87 # - 550 5.7.30 This mail has been blocked because DKIM does not pass. Gmail requires all
88 # large senders to authenticate with DKIM. Authentication results: DKIM = did not pass.
89 # For instructions on setting up DKIM authentication, go to Turn on DKIM for your domain.
90 ['550', '5.7.30', 'senders to authenticate with dkim'],
91  
92 # - 421 4.7.32 Your email has been rate limited because the From: header (RFC5322) in
93 # this message isn't aligned with either the authenticated SPF or DKIM organizational
94 # domain.
95 # - 421 5.7.32 Your email was blocked because the From: header (RFC5322) in this message
96 # isn't aligned with either the authenticated SPF or DKIM organizational domain.
97 ['421', '4.7.32', 'aligned with either the authenticated spf or dkim'],
98 ["421", "5.7.32", "aligned with either the authenticated spf or dkim"],
99  
100 # - 421 4.7.40 Your email has been rate limited because the sending domain doesn't
101 # have a DMARC record, or the DMARC record doesn't specify a DMARC policy. Gmail
102 # requires all bulk email senders to add a DMARC record to their sending domain.
103 # - 550 5.7.40 Your message was blocked because the sending domain doesn't have a DMARC
104 # record or the DMARC record doesn?ft specify a DMARC policy. Gmail requires all bulk
105 # email senders to add a DMARC record to their sending domain.
106 ["421", "4.7.40", "to add a dmarc record to "],
107 ["550", "5.7.40", "to add a dmarc record to "],
108 ],
109 $Sisimai::Eb::ReFAMA => [
110 # - 421 4.7.0 This message is suspicious due to the very low reputation of the sending
111 # IP address/domain. To protect our users from spam, mail sent from your IP address
112 # has been temporarily rate limited. For more information, go to Why has Gmail blocked
113 # my messages?. https://support.google.com/mail/answer/188131
114 ['421', '4.7.0', 'very low reputation of the sending ip address'],
115 ['421', '4.7.0', 'very low reputation of the sending domain'],
116  
117 # - 550 5.7.1 Our system has detected that this message is likely suspicious due to the
118 # very low reputation of the sending IP address/domain. To best protect our users
119 # from spam, the message has been blocked.
120 # Please visit https://support.google.com/mail/answer/188131 for more information.
121 ['550', '5.7.1', 'due to the very low reputation of the sending ip address'],
122 ['550', '5.7.1', 'due to the very low reputation of the sending domain'],
123 ],
124 $Sisimai::Eb::ReBLOC => [
125 # - 421 4.7.0 IP not in whitelist for RCPT domain, closing connection.
126 # For more information, go to Allowlists, denylists, and approved senders.
127 # https://support.google.com/a/answer/60752
128 ['421', '4.7.0', 'ip not in whitelist for rcpt domain'],
129  
130 # - 421 4.7.0 Try again later, closing connection. This usually indicates a Denial of
131 # Service (DoS) for the SMTP relay at the HELO stage.
132 # https://support.google.com/a/answer/3221692
133 ['421', '4.7.0', 'try again later, closing connection.'],
134  
135 # - 501 5.5.4 HELO/EHLO argument is invalid. https://support.google.com/mail/?p=helo
136 ['501', '5.5.4', 'empty helo/ehlo argument not allowed'],
137 ['501', '5.5.4', 'helo/ehlo argument is invalid'],
138  
139 # - 421 4.7.28 Gmail has detected an unusual rate of mail
140 # (originating from)
141 # - your IP address 192.0.2.25
142 # - your IP Netblock 192.0.2.0/24 (?)
143 # - your DKIM domain example.org
144 # - your SPF domain example.org
145 # (containing one of your URL domains)
146 #
147 # To protect our users from spam, mail has been temporarily rate limited. To review
148 # our bulk email senders guidelines, go to Email sender guidelines.
149 # https://support.google.com/mail/?p=UnsolicitedRateLimitError
150 ['421', '4.7.0', 'an unusual rate of unsolicited mail'],
151 ['421', '4.7.28', 'an unusual rate of mail'],
152  
153 # - 550 5.7.1 Our system has detected an unusual rate of unsolicited mail originating
154 # from your IP address. To protect our users from spam, mail sent from your IP ad-
155 # dress has been blocked. Review https://support.google.com/mail/answer/81126
156 #
157 # - 550 5.7.28 There is an unusual rate of unsolicited mail originating from your IP
158 # address. To protect our users from spam, mail sent from your IP address has been
159 # blocked. To review our bulk email senders guidelines, go to Email sender guidelines.
160 ['550', '5.7.1', 'an unusual rate of unsolicited mail'],
161 ['550', '5.7.28', 'an unusual rate of unsolicited mail'],
162 ],
163 $Sisimai::Eb::ReBODY => [
164 # - 552 5.7.0 Our system detected an illegal attachment on your message. Please visit
165 # http://mail.google.com/support/bin/answer.py?answer=6590 to review our attachment
166 # guidelines.
167 ['552', '5.7.0', 'illegal attachment on your message'],
168  
169 # - 552 5.7.0 This message was blocked because its content presents a potential securi-
170 # ty issue. Please visit https://support.google.com/mail/?p=BlockedMessage to review
171 # our message content and attachment content guidelines.
172 ['552', '5.7.0', 'blocked because its content presents a potential security issue'],
173 ],
174 $Sisimai::Eb::ReSIZE => [
175 # - 552 5.2.3 Your message exceeded Google's message size limits. For more information,
176 # visit https://support.google.com/mail/answer/6584
177 ['552', '5.2.3', "exceeded google's message size limits"],
178  
179 # - 552 5.3.4 The number of attachments (num-attachments) exceeds Google's limit of
180 # limit attachments. To view our attachment size guidelines, go to Gmail receiving
181 # limits in Google Workspace. https://support.google.com/a/answer/1366776
182 #
183 # - 552 5.3.4 The size of the <header name> header value (size bytes) exceeds Google's
184 # limit of limit bytes per individual header size. To view our header size guidelines,
185 # go to Gmail message header limits https://support.google.com/a?p=header-limits
186 #
187 # - 552 5.3.4 Your message exceeded Google's message size limits. To view our message
188 # size guidelines, go to Send attachments with your Gmail message.
189 # - https://support.google.com/mail/?p=MaxSizeError
190 #
191 # - 552 5.3.4 The size of your message (size bytes) exceeded Google's message size
192 # limits of limit bytes. To view our message size guidelines, go to Gmail receiving
193 # limits in Google Workspace.
194 # - https://support.google.com/mail/?p=MaxSizeError
195 ['552', '5.3.4', "exceeds google's message size limit of"],
196 ['552', '5.3.4', "exceeded google's message size limits"],
197 ['552', '5.3.4', "exceeds google's limit of limit attachments."],
198 ['552', '5.3.4', "your message exceeded google's message header size limits"],
199 ['552', '5.3.4', 'bytes per individual header size'],
200 ['552', '5.3.4', "exceeds google's header name limit of"],
201 ['552', '5.3.4', "exceeds google's message header size limit"]
202 ],
203 $Sisimai::Eb::ReTIME => [
204 # - 421 4.7.0 Connection expired, try reconnecting. For more information, go to About
205 # SMTP error messages. https://support.google.com/a/answer/3221692
206 ['421', '4.7.0', 'connection expired'],
207  
208 # - 451 4.4.2 Timeout - closing connection. For more information, go to About SMTP
209 # error messages. https://support.google.com/a/answer/3221692
210 ['451', '4.4.2', 'timeout - closing connection'],
211 ],
212 $Sisimai::Eb::ReTTLS => [
213 # - 530 5.7.0 Must issue a STARTTLS command first. For more information, go to About
214 # SMTP error messages and review RFC 3207 specifications.
215 ['530', '5.7.0', 'must issue a starttls command first'],
216 ['454', '5.5.1', 'starttls may not be repeated'],
217  
218 # - 421 4.7.0 TLS required for RCPT domain, closing connection. For more information,
219 # go to Email encryption in transit. https://support.google.com/mail/answer/6330403
220 ['421', '4.7.0', 'tls required for rcpt domain'],
221  
222 # - 421 4.7.29 Your email has been rate limited because this message wasn't sent over a
223 # TLS connection. Gmail requires all bulk email senders to use TLS/SSL for SMTP conn-
224 # ections.
225 ['421', '4.7.29', 'senders to use tls/ssl for smtp'],
226 ['550', '5.7.29', 'senders to use tls/ssl for smtp'],
227 ],
228 $Sisimai::Eb::ReFULL => [
229 # - 452 4.2.2 The recipient's inbox is out of storage space.
230 # Please direct the recipient to https://support.google.com/mail/?p=OverQuotaTemp
231 # - Please direct the recipient to https://support.google.com/mail/?p=OverQuotaPerm
232 ['452', '4.2.2', 'inbox is out of storage space'],
233 ['552', '5.2.2', 'inbox is out of storage space and inactive'],
234  
235 # - 452 4.2.2 The email account that you tried to reach is over quota. Please direct
236 # the recipient to Clear Google Drive space & increase storage.
237 ['452', '4.2.2', 'is over quota'],
238 ['552', '5.2.2', 'is over quota'],
239 ['550', '5.7.1', 'email quota exceeded'],
240 ],
241 $Sisimai::Eb::ReINET => [
242 # - 554 5.4.6 Message exceeded 50 hops, this may show a mail loop. For details,
243 # go to SMTP relay service error messages.
244 # - https://support.google.com/mail/?p=MailLoop
245 ['554', '5.4.6', 'message exceeded 50 hops'],
246 ['554', '5.6.0', 'message exceeded 50 hops'],
247 ],
248 $Sisimai::Eb::RePASS => [
249 # - 550 5.7.0 Mail relay denied <ip-address>. Invalid credentials for relay for one of
250 # the domains in: <domain-name> (as obtained from HELO and MAIL FROM). Email is being
251 # sent from a domain or IP address which isn't registered in your Workspace account.
252 # Please login to your Workspace account and verify that your sending device IP
253 # address has been registered within the Workspace SMTP Relay Settings. For more
254 # information, go to SMTP relay service error messages.
255 # - https://support.google.com/a/answer/6140680#maildenied
256 ['550', '5.7.0', 'mail relay denied'],
257  
258 # - 550 5.7.1 Invalid credentials for relay <ip-address>. The IP address you've
259 # registered in your Workspace SMTP Relay service doesn't match the domain of the
260 # account this email is being sent from. If you are trying to relay mail from a
261 # domain that isn't registered under your Workspace account or has empty
262 # envelope-from:, you must configure your mail server either to use SMTP AUTH to
263 # identify the sending domain or to present one of your domain names in the HELO or
264 # EHLO command. For more information, go to SMTP relay service error messages.
265 # - https://support.google.com/a/answer/6140680#invalidcred
266 ['550', '5.7.1', 'invalid credentials for relay'],
267  
268 # - 550 7.7.1 The IP you're using to send mail is not authorized to send email directly
269 # to our servers. Use the SMTP relay at your service provider instead. For more
270 # information, go to 'The IP you're using to send email is not authorized...'.
271 # - https://support.google.com/mail/?p=NotAuthorizedError
272 ['550', '5.7.1', 'is not authorized to send email directly to our servers'],
273 ],
274 $Sisimai::Eb::ReNRFC => [
275 # - 550 5.7.1 Messages missing a valid address in the From: header, or having no From:
276 # header, are not accepted. For more information, go to Email sender guidelines and
277 # review RFC 5322 specifications.
278 # - https://support.google.com/mail/?p=RfcMessageNonCompliant
279 ['550', '5.7.1', 'missing a valid address in the from: header'],
280 ['550', '5.7.1', 'multiple addresses in from: header are not accepted'],
281  
282 # - 550 5.7.1 This message is not RFC 5322 compliant because it has duplicate headers.
283 # To reduce the amount of spam sent to Gmail, this message has been blocked. For more
284 # information, go to Email sender guidelines and review RFC 5322 specifications.
285 # - https://support.google.com/mail/?p=RfcMessageNonCompliant
286 ['550', '5.7.1', 'is not rfc 5322 compliant'],
287  
288 # - 550 5.7.1 Messages missing a valid Message-ID: header are not accepted. For more
289 # information, go to Email sender guidelines and review RFC 5322 specifications.
290 # - https://support.google.com/mail/?p=RfcMessageNonCompliant
291 ['550', '5.7.1', 'missing a valid message-id: header'],
292  
293 # - 550 5.7.1 The message contains a unicode character in a disallowed header.
294 # To review our message and header content guidelines, go to File types blocked in
295 # Gmail. https://support.google.com/mail/?p=BlockedMessage
296 ['550', '5.7.1', 'contains a unicode character in a disallowed header'],
297  
298 # - 550 5.7.1 Encoded-word syntax is not permitted in message header header-name. To
299 # reduce the amount of spam sent to Gmail, this message has been blocked. For more
300 # information, go to Email sender guidelines and review RFC 5322 specifications.
301 # - https://support.google.com/mail/?p=RfcMessageNonCompliant
302 ['550', '5.7.1', 'encoded-word syntax is not permitted'],
303  
304 # - 553 5.1.7 The sender address address is not a valid RFC 5321 address. For more
305 # information, go to About SMTP error messages and review RFC 5321 specifications.
306 # - https://support.google.com/a/answer/3221692
307 ['553', '5.1.7', 'is not a valid rfc 5321 address'],
308  
309 # - 554 5.6.0 Mail message is malformed. Not accepted. For more information, go to
310 # Email sender guidelines and review RFC 5322 specifications.
311 # - https://support.google.com/mail/?p=RfcMessageNonCompliant
312 ['554', '5.6.0', 'mail message is malformed'],
313 ],
314 $Sisimai::Eb::ReWONT => [
315 # - 550 5.7.1 The user or domain that you are sending to (or from) has a policy that
316 # prohibited the mail that you sent. Please contact your domain administrator for
317 # further details.
318 # For more information, visit https://support.google.com/a/answer/172179
319 ['550', '5.7.1', 'you are sending to (or from) has a policy that prohibited'],
320 ],
321 $Sisimai::Eb::ReRATE => [
322 # - 450 4.2.1 The user you are trying to contact is receiving mail too quickly. Please
323 # resend your message at a later time. If the user is able to receive mail at that
324 # time, your message will be delivered.
325 # For more information, visit https://support.google.com/mail/answer/22839
326 #
327 # - 450 4.2.1 Peak SMTP relay limit exceeded for customer. This is a temporary error.
328 # For more information on SMTP relay limits, please contact your administrator or
329 # visit https://support.google.com/a/answer/6140680
330 ['450', '4.2.1', 'is receiving mail too quickly'],
331 ['450', '4.2.1', 'peak smtp relay limit exceeded for customer'],
332  
333 # - 450 4.2.1 The user you are trying to contact is receiving mail at a rate that pre-
334 # vents additional messages from being delivered. Please resend your message at a
335 # later time. If the user is able to receive mail at that time, your message will be
336 # delivered. For more information, visit https://support.google.com/mail/answer/6592
337 # - https://support.google.com/mail/?p=ReceivingRatePerm
338 ['450', '4.2.1', 'rate that prevents additional messages from being delivered'],
339 ['550', '5.2.1', 'rate that prevents additional messages from being delivered'],
340  
341 # - 452 4.5.3 Your message has too many recipients. For more information regarding
342 # Google's sending limits, visit https://support.google.com/mail/answer/6592
343 # https://support.google.com/mail/?p=TooManyRecipientsError
344 ['452', '4.5.3', 'your message has too many recipients'],
345 ['550', '5.5.3', 'too many recipients for this sender'],
346  
347 # - 550 5.4.5 Daily SMTP relay limit exceeded for user. For more information on SMTP
348 # relay sending limits please contact your administrator or visit SMTP relay service
349 # error messages.
350 # https://support.google.com/a/answer/6140680
351 # - https://support.google.com/a/answer/166852
352 ['550', '5.4.5', 'daily sending quota exceeded'],
353 ['550', '5.4.5', 'daily user sending limit exceeded'],
354 ['550', '5.4.5', 'daily smtp relay limit exceeded for'],
355 ['550', '5.7.1', 'daily smtp relay limit exceeded for'],
356 ['550', '5.7.1', 'daily smtp relay sending limit exceeded for'],
357 ['550', '5.7.1', 'this mail has been rate limited'],
358  
359 # - 421 4.7.28 Gmail has detected this message exceeded its quota for sending messages
360 # with the same Message-ID:. To best protect our users, the message has been tempo-
361 # rarily rejected. For more information, go to Why has Gmail blocked my messages?.
362 # https://support.google.com/mail/answer/188131
363 ['421', '4.7.28', 'sending messages with the same message-id:'],
364 ],
365 $Sisimai::Eb::ReFROM => [
366 # - 550 5.7.0, Mail Sending denied. This error occurs if the sender account is disabled
367 # or not registered within your Google Workspace domain.
368 # - https://support.google.com/a/answer/6140680#maildenied
369 ['550', '5.7.0', 'mail sending denied'],
370 ['550', '5.7.1', 'unauthenticated email is not accepted'],
371 ],
372 $Sisimai::Eb::ReQPTR => [
373 # - 421 4.7.0 The IP address sending this message does not have a PTR record, or the
374 # corresponding forward DNS entry does not point to the sending IP. To protect our
375 # users from spam, mail sent from your IP address has been temporarily rate limited.
376 # For more information, go to Email sender guidelines.
377 ['421', '4.7.0', 'does not have a ptr record'],
378  
379 # - 421 4.7.23 The sending IP address for this message doesn't have a PTR record, or
380 # the PTR record's forward DNS entry doesn't match the sending IP address. To protect
381 # users from spam, your email has been temporarily rate limited.
382 ['421', '4.7.23', ' have a ptr record, or the ptr record'],
383  
384 # - 550 5.7.1 This message does not meet IPv6 sending guidelines regarding PTR records
385 # and authentication. For more information, go to Email sender guidelines.
386 # https://support.google.com/mail/?p=IPv6AuthError
387 #
388 # - 550 5.7.25 The IP address sending this message does not have a PTR record setup, or
389 # the corresponding forward DNS entry does not point to the sending IP. As a policy,
390 # Gmail does not accept messages from IPs with missing PTR records.
391 # For more information, go to Email sender guidelines.
392 # - https://support.google.com/mail/answer/81126#ip-practices
393 #
394 # - 550 5.7.25 The sending IP does not match the IP address of the hostname specified
395 # in the pointer (PTR) record. For more information, go to Email sender guidelines.
396 # - https://support.google.com/mail/answer/81126#ip-practices
397 ['550', '5.7.1', 'does not meet ipv6 sending guidelines regarding ptr records and authentication'],
398 ['550', '5.7.25', 'does not have a ptr record'],
399 ['550', '5.7.25', 'does not match the ip address of the hostname'],
400 ],
401 $Sisimai::Eb::ReSAFE => [
402 # - 454 4.7.0 Too many sign-in attempts, try again later. For details,
403 # go to SMTP relay service error messages.
404 # - https://support.google.com/mail/answer/7126229
405 ['454', '4.7.0', 'too many sign-in attempts'],
406  
407 # - 503 5.7.0 No identity changes permitted. For more information, go to About SMTP
408 # error messages.
409 ['501', '5.5.2', 'cannot decode response'], # 2FA related error, maybe.
410 ['503', '5.7.0', 'no identity changes permitted'],
411  
412 # - 530 5.5.1 Authentication Required. For more information, visit
413 # https://support.google.com/accounts/troubleshooter/2402620
414 # - https://support.google.com/mail/?p=WantAuthError
415 ['530', '5.5.1', 'authentication required.'],
416 ['530', '5.7.0', 'authentication required.'],
417  
418 # - 535 5.7.1 Application-specific password required.
419 # For more information, visit https://support.google.com/accounts/answer/185833
420 ['535', '5.7.1', 'application-specific password required'],
421 ['535', '5.7.90', 'application-specific password required'],
422  
423 # - 535 5.7.1 Please log in with your web browser and then try again. For more infor-
424 # mation, visit https://support.google.com/mail/bin/accounts/answer/78754
425 ['535', '5.7.1', 'please log in with your web browser'],
426 ['534', '5.7.90', 'please log in with your web browser'],
427 ['534', '5.7.14', 'please log in through your web browser'],
428  
429 # - 535 5.7.1 Username and Password not accepted. For more information, visit
430 # https://support.google.com/accounts/troubleshooter/2402620
431 ['535', '5.7.1', 'username and password not accepted'],
432 ['535', '5.7.80', 'username and password not accepted'],
433 ],
434 $Sisimai::Eb::ReSPAM => [
435 # - 421 4.7.0 This message is suspicious due to the nature of the content or the links
436 # within. To best protect our users from spam, the message has been blocked. For more
437 # information, go to Why has Gmail blocked my messages?.
438 # https://support.google.com/mail/answer/188131
439 ['421', '4.7.0', 'due to the nature of the content or the links within'],
440  
441 # - 550 5.7.1 Our system has detected that this message is likely unsolicited mail. To
442 # reduce the amount of spam sent to Gmail, this message has been blocked.
443 # For more information, visit https://support.google.com/mail/answer/188131
444 # - https://support.google.com/mail/?p=UnsolicitedMessageError
445 ['550', '5.7.1', 'likely unsolicited mail'],
446 ],
447 $Sisimai::Eb::ReQUIT => [
448 # - 550 5.2.1 The email account that you tried to reach is inactive.
449 # For more information, go to https://support.google.com/mail/?p=DisabledUser
450 ['550', '5.2.1', 'account that you tried to reach is disabled'],
451 ['550', '5.2.1', 'account that you tried to reach is inactive'],
452 ],
453 $Sisimai::Eb::ReCOMM => [
454 # - 523 5.7.10 SMTP protocol violation, no commands allowed to pipeline after STARTTLS.
455 # For more information, go to About SMTP error messages and review RFC 3207
456 # specifications.
457 ['451', '4.5.0', 'smtp protocol violation'],
458 ['454', '4.5.0', 'smtp protocol violation'],
459 ['525', '5.7.10', 'smtp protocol violation'],
460 ['535', '5.5.4', 'optional argument not permitted'],
461  
462 # - 501 5.5.2 Syntax error, cannot decode response. For more information, go to About
463 # SMTP error messages.
464 # - https://support.google.com/a/answer/3221692
465 # - 501 5.7.11 Syntax error (no parameters allowed). For more information, go to About
466 # SMTP error messages and review RFC 3207 specifications.
467 ['501', '5.7.11', 'syntax error'],
468 ['501', '5.5.2', 'syntax error'],
469 ['555', '5.5.2', 'syntax error'],
470  
471 # - 503 5.5.1 Bad sequence of commands. For more information, go to About SMTP error
472 # messages and review RFC 5321 specifications.
473 # - https://support.google.com/mail/?p=helo
474 #
475 # - 503 5.5.1 No DATA after BDAT. A mail transaction protocol command was issued out of
476 # sequence. For more information, go to About SMTP error messages and review RFC 3030
477 # specifications.
478 # - https://support.google.com/a/answer/3221692
479 ['502', '5.5.1', 'too many unrecognized commands, goodbye'],
480 ['502', '5.5.1', 'unimplemented command'],
481 ['502', '5.5.1', 'unrecognized command'],
482 ['503', '5.5.1', 'bad sequence of commands'],
483 ['503', '5.5.1', 'ehlo/helo first'],
484 ['503', '5.5.1', 'mail first'],
485 ['503', '5.5.1', 'rcpt first'],
486 ['503', '5.5.1', 'no data after bdat'],
487 ['504', '5.7.40', 'unrecognized authentication type'],
488 ['504', '5.7.40', 'xoauth is no longer supported'],
489 ['554', '5.7.0', 'too many unauthenticated commands'],
490 ],
491 $Sisimai::Eb::RePROC => [
492 # About SMTP error messages, https://support.google.com/a/answer/3221692
493 ['421', '4.3.0', 'temporary system problem'],
494 ['421', '4.7.0', 'temporary system problem'],
495 ['421', '4.4.5', 'server busy'],
496  
497 # - 451 4.3.0 Multiple destination domains per transaction is unsupported. Please try
498 # again. For more information, go to About SMTP error messages and review RFC 5321
499 # specifications. https://support.google.com/a/answer/3221692
500 ['451', '4.3.0', 'multiple destination domains per transaction is unsupported'],
501 ['451', '4.3.0', 'mail server has temporarily rejected this message'],
502 ['451', '4.3.0', 'mail server temporarily rejected message'],
503  
504 # - 452 4.5.3 Domain policy size per transaction exceeded, please try this recipient in
505 # a separate transaction. This message means the email policy size (size of policies,
506 # number of policies, or both) for the recipient domain has been exceeded.
507 # https://support.google.com/a/answer/7282433
508 ['452', '4.5.3', 'domain policy size per transaction exceeded'],
509  
510 # - 454 4.7.0 Cannot sign in due to a temporary system problem. Try again later.
511 # For details, go to SMTP relay service error messages.
512 # - https://support.google.com/a/answer/3221692
513 ['454', '4.7.0', 'cannot sign in due to a temporary system problem'],
514 ],
515 $Sisimai::Eb::ReUSER => [
516 # - 550 5.1.1 The email account that you tried to reach does not exist. Please try dou-
517 # ble-checking the recipient's email address for typos or unnecessary spaces.
518 # For more information, visit https://support.google.com/mail/answer/6596
519 # - https://support.google.com/mail/?p=NoSuchUser
520 ['550', '5.1.1', 'the email account that you tried to reach does not exist'],
521  
522 # - 553 5.1.2 We weren't able to find the recipient domain. Please check for any spell-
523 # ing errors, and make sure you didn't enter any spaces, periods, or other punctua-
524 # tion after the recipient's email address.
525 # - https://support.google.com/mail/?p=BadRcptDomain
526 ['553', '5.1.2', "we weren't able to find the recipient domain"],
527  
528 # - 553 5.1.3 The recipient address <address> is not a valid RFC 5321 address. For more
529 # information, go to About SMTP error messages and review RFC 5321 specifications.
530 # - https://support.google.com/a/answer/3221692
531 ['553', '5.1.3', 'is not a valid rfc 5321 address'],
532 ],
533 };
534  
535 130 my $statuscode = substr($argvs->{'deliverystatus'}, 2); # 5.7.1 => 7.1
536 130 my $esmtpreply = substr($argvs->{'replycode'}, 1, 2); # 421 => 21
537 130 my $issuedcode = lc $argvs->{'diagnosticcode'};
538 130 my $reasontext = '';
539  
540 130 REASON: for my $e ( keys %$messagesof ) {
541 # Each key is a reason name
542 1480 for my $f ( $messagesof->{ $e }->@* ) {
543 # Try to match an SMTP reply code, a D.S.N., and an error message
544 8329 ▶ next unless index($issuedcode, $f->[2]) > -1;
Branch: 1 branch
BranchTrueFalseTotal
unless index($issuedcode, $f->[2]) != -1 8170 159 8329
545 159 ▶ next unless index($f->[0], $esmtpreply) > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless index($f->[0], $esmtpreply) > 0 34 125 159
546 125 ▶ next unless index($f->[1], $statuscode) > 1;
Branch: 1 branch
BranchTrueFalseTotal
unless index($f->[1], $statuscode) > 1 10 115 125
547 115 $reasontext = $e;
548 115 last REASON;
549 }
550 }
551 130 return $reasontext;
552 }
553  
554 9 1;
555 __END__
« Sisimai/Fact/YAML.pm ↑ Summary Sisimai/String.pm »