| 1 | package Sisimai::Lhost::GMX; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 41 | ▶ | use parent 'Sisimai::Lhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 41 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 41 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 41 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub description { 'GMX: https://gmx.net/' } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 925 | ▶ | sub inquire { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inquire: called CC=19 SCAR=29.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Detect an error from GMX and mail.com | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # @param [Hash] mhead Message headers of a bounce email | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # @param [String] mbody Message body of a bounce email | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # @return [Hash] Bounce data list and message/rfc822 part | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # @return [undef] failed to decode or the arguments are missing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # @since v4.1.4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 925 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 925 | ▶ | my $mhead = shift // return undef; return undef unless defined $mhead->{'x-gmx-antispam'}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
shift() // (return undef)
MC/DC100%1/1
shift() // (return undef)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 21 | ▶ | my $mbody = shift // return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // (return undef)
MC/DC0%0/1
shift() // (return undef)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # Envelope-To: <kijitora@mail.example.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # X-GMX-Antivirus: 0 (no virus found) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # X-UI-Out-Filterresults: unknown:0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 21 | require Sisimai::SMTP::Command; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 21 | state $indicators = __PACKAGE__->INDICATORS; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 21 | state $boundaries = ['--- The header of the original message is following. ---']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 21 | state $startingof = {'message' => ['This message was created automatically by mail delivery software']}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 21 | ▶ | my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries) // return undef; return undef unless $emailparts->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
MC/DC0%0/1
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
"Sisimai::RFC5322"->part($mbody, $boundaries)
Truth table50%1/2
A
A= "Sisimai::RFC5322"->part($mbody, $boundaries)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 21 | my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 21 | my $readcursor = 0; # (Integer) Points the current cursor position | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 21 | my $recipients = 0; # (Integer) The number of 'Final-Recipient' header | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 21 | for my $e ( split("\n", $emailparts->[0]) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # Read error messages and delivery status lines from the head of the email to the previous | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # line of the beginning of the original message. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 230 | ▶ | unless( $readcursor ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Beginning of the bounce message or message/delivery-status part | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 21 | ▶ | $readcursor |= $indicators->{'deliverystatus'} if index($e, $startingof->{'message'}->[0]) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 21 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 209 | ▶ | next if ($readcursor & $indicators->{'deliverystatus'}) == 0 || $e eq ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
MC/DC50%1/2
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
($readcursor & $indicators->{"deliverystatus"}) == 0
$e eq ""
Truth table66%2/3
A or B
A= ($readcursor & $indicators->{"deliverystatus"}) == 0B= $e eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # This message was created automatically by mail delivery software. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # A message that you sent could not be delivered to one or more of | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # its recipients. This is a permanent error. The following address | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # failed: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # "shironeko@example.jp": | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # SMTP error from remote server after RCPT command: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # host: mx.example.jp | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # 5.1.1 <shironeko@example.jp>... User Unknown | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 162 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 162 | ▶ | if( index($e, '@') > 1 && (index($e, '"') == 0 || index($e, '<') == 0) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%6/6
index($e, "\@") > 1 and index($e, "\"") == 0 || index($e, "<") == 0
index($e, "\"") == 0 or index($e, "<") == 0
MC/DC100%3/3
index($e, "\@") > 1 and index($e, "\"") == 0 || index($e, "<") == 0
index($e, "\@") > 1
index($e, "\"") == 0
index($e, "<") == 0
Truth table100%4/4
A and B or C
A= index($e, "\@") > 1B= index($e, "\"") == 0C= index($e, "<") == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # "shironeko@example.jp": | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # ---- OR ---- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # <kijitora@6jo.example.co.jp> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # Reason: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # delivery retry timeout exceeded | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 26 | ▶ | if( $v->{'recipient'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # There are multiple recipient addresses in the message body. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | push @$dscontents, __PACKAGE__->DELIVERYSTATUS; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 5 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 26 | $v->{'recipient'} = Sisimai::Address->s3s4($e); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 26 | $recipients++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } elsif( index($e, 'SMTP error ') == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # SMTP error from remote server after RCPT command: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 21 | $v->{'command'} = Sisimai::SMTP::Command->find($e); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } elsif( index($e, 'host: ') == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # host: mx.example.jp | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 21 | $v->{'rhost'} = substr($e, 6, ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Get error messages | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 94 | ▶ | next unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 94 | $v->{'diagnosis'} .= $e." "; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 21 | ▶ | return undef unless $recipients; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 21 | return {"ds" => $dscontents, "rfc822" => $emailparts->[1]}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 41 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||