| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sisimai::Rhost::GSuite; |
|
2
|
6
|
|
|
6
|
|
893
|
use v5.26; |
|
|
6
|
|
|
|
|
19
|
|
|
3
|
6
|
|
|
6
|
|
27
|
use strict; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
176
|
|
|
4
|
6
|
|
|
6
|
|
22
|
use warnings; |
|
|
6
|
|
|
|
|
6
|
|
|
|
6
|
|
|
|
|
1832
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub find { |
|
7
|
|
|
|
|
|
|
# Detect bounce reason from Google Workspace (formerly G Suite) https://workspace.google.com/ |
|
8
|
|
|
|
|
|
|
# @param [Sisimai::Fact] argvs Decoded email object |
|
9
|
|
|
|
|
|
|
# @return [String] The bounce reason for GSuite |
|
10
|
|
|
|
|
|
|
# @since v5.2.0 |
|
11
|
147
|
|
|
147
|
0
|
1156
|
my $class = shift; |
|
12
|
147
|
100
|
100
|
|
|
342
|
my $argvs = shift // return ""; return '' unless length $argvs->{'diagnosticcode'}; |
|
|
146
|
|
|
|
|
366
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
145
|
|
|
|
|
207
|
state $messagesof = { |
|
15
|
|
|
|
|
|
|
"hostunknown" => [" responded with code NXDOMAIN", "Domain name not found"], |
|
16
|
|
|
|
|
|
|
"networkerror" => [" had no relevant answers.", "responded with code NXDOMAIN", "Domain name not found"], |
|
17
|
|
|
|
|
|
|
"notaccept" => ["Null MX"], |
|
18
|
|
|
|
|
|
|
"userunknown" => ["because the address couldn't be found. Check for typos or unnecessary spaces and try again."], |
|
19
|
|
|
|
|
|
|
}; |
|
20
|
145
|
100
|
|
|
|
205
|
my $statuscode = ""; $statuscode = substr($argvs->{'deliverystatus'}, 0, 1) if $argvs->{'deliverystatus'}; |
|
|
145
|
|
|
|
|
537
|
|
|
21
|
145
|
100
|
|
|
|
219
|
my $esmtpreply = ""; $esmtpreply = substr($argvs->{'replycode'}, 0, 1) if $argvs->{'replycode'}; |
|
|
145
|
|
|
|
|
449
|
|
|
22
|
145
|
|
|
|
|
191
|
my $reasontext = ""; |
|
23
|
|
|
|
|
|
|
|
|
24
|
145
|
|
|
|
|
419
|
for my $e ( keys %$messagesof ) { |
|
25
|
|
|
|
|
|
|
# The key is a bounce reason name |
|
26
|
464
|
100
|
|
|
|
582
|
next unless grep { index($argvs->{'diagnosticcode'}, $_) > -1 } $messagesof->{ $e }->@*; |
|
|
826
|
|
|
|
|
1508
|
|
|
27
|
117
|
50
|
33
|
|
|
366
|
next if $e eq "networkerror" && ($statuscode eq "5" || $esmtpreply eq "5"); |
|
|
|
|
66
|
|
|
|
|
|
28
|
117
|
50
|
33
|
|
|
316
|
next if $e eq "hostunknown" && ($statuscode eq "4" || $statuscode eq ""); |
|
|
|
|
66
|
|
|
|
|
|
29
|
88
|
0
|
0
|
|
|
153
|
next if $e eq "hostunknown" && ($esmtpreply eq "4" || $esmtpreply eq ""); |
|
|
|
|
33
|
|
|
|
|
|
30
|
88
|
|
|
|
|
84
|
$reasontext = $e; last; |
|
|
88
|
|
|
|
|
149
|
|
|
31
|
|
|
|
|
|
|
} |
|
32
|
145
|
|
|
|
|
417
|
return $reasontext; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
|
36
|
|
|
|
|
|
|
__END__ |