| 1 | package Sisimai::Rhost::GSuite; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 147 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=16 SCAR=29.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 147 | ▶ | my $argvs = shift // return ""; return '' unless length $argvs->{'diagnosticcode'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 145 | require Sisimai::Eb; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 145 | state $messagesof = { | |||||||||||||||||||||||||||||||||||||||||
| 16 | $Sisimai::Eb::ReHOST => [" responded with code NXDOMAIN", "Domain name not found"], | ||||||||||||||||||||||||||||||||||||||||||
| 17 | $Sisimai::Eb::ReINET => [" had no relevant answers.", "responded with code NXDOMAIN", "Domain name not found"], | ||||||||||||||||||||||||||||||||||||||||||
| 18 | $Sisimai::Eb::Re00MX => ["Null MX"], | ||||||||||||||||||||||||||||||||||||||||||
| 19 | $Sisimai::Eb::ReUSER => ["because the address couldn't be found. Check for typos or unnecessary spaces and try again."], | ||||||||||||||||||||||||||||||||||||||||||
| 20 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 145 | ▶ | my $statuscode = ""; $statuscode = substr($argvs->{'deliverystatus'}, 0, 1) if $argvs->{'deliverystatus'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 145 | ▶ | my $esmtpreply = ""; $esmtpreply = substr($argvs->{'replycode'}, 0, 1) if $argvs->{'replycode'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 145 | my $reasontext = ""; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 145 | for my $e ( keys %$messagesof ) { | |||||||||||||||||||||||||||||||||||||||||
| 26 | # The key is a bounce reason name | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 495 | ▶ | next unless grep { index($argvs->{'diagnosticcode'}, $_) > -1 } $messagesof->{ $e }->@*; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 115 | ▶ | next if $e eq $Sisimai::Eb::ReINET && ($statuscode eq "5" || $esmtpreply eq "5"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$e eq $Sisimai::Eb::ReINET and $statuscode eq 5 || $esmtpreply eq 5
$statuscode eq 5 or $esmtpreply eq 5
MC/DC0%0/3
$e eq $Sisimai::Eb::ReINET and $statuscode eq 5 || $esmtpreply eq 5
$e eq $Sisimai::Eb::ReINET
$statuscode eq 5
$esmtpreply eq 5
Truth table50%2/4
A and B or C
A= $e eq $Sisimai::Eb::ReINETB= $statuscode eq 5C= $esmtpreply eq 5
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 115 | ▶ | next if $e eq $Sisimai::Eb::ReHOST && ($statuscode eq "4" || $statuscode eq ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$e eq $Sisimai::Eb::ReHOST and $statuscode eq 4 || $statuscode eq ""
$statuscode eq 4 or $statuscode eq ""
MC/DC33%1/3
$e eq $Sisimai::Eb::ReHOST and $statuscode eq 4 || $statuscode eq ""
$e eq $Sisimai::Eb::ReHOST
$statuscode eq 4
$statuscode eq ""
Truth table50%2/4
A and B or C
A= $e eq $Sisimai::Eb::ReHOSTB= $statuscode eq 4C= $statuscode eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 88 | ▶ | next if $e eq $Sisimai::Eb::ReHOST && ($esmtpreply eq "4" || $esmtpreply eq ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$e eq $Sisimai::Eb::ReHOST and $esmtpreply eq 4 || $esmtpreply eq ""
$esmtpreply eq 4 or $esmtpreply eq ""
MC/DC0%0/3
$e eq $Sisimai::Eb::ReHOST and $esmtpreply eq 4 || $esmtpreply eq ""
$e eq $Sisimai::Eb::ReHOST
$esmtpreply eq 4
$esmtpreply eq ""
Truth table25%1/4
A and B or C
A= $e eq $Sisimai::Eb::ReHOSTB= $esmtpreply eq 4C= $esmtpreply eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 88 | $reasontext = $e; last; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 145 | return $reasontext; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||||||||||||||||