| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sisimai::Lhost::X6; |
|
2
|
14
|
|
|
14
|
|
6104
|
use parent 'Sisimai::Lhost'; |
|
|
14
|
|
|
|
|
30
|
|
|
|
14
|
|
|
|
|
84
|
|
|
3
|
14
|
|
|
14
|
|
869
|
use feature ':5.10'; |
|
|
14
|
|
|
|
|
23
|
|
|
|
14
|
|
|
|
|
949
|
|
|
4
|
14
|
|
|
14
|
|
81
|
use strict; |
|
|
14
|
|
|
|
|
19
|
|
|
|
14
|
|
|
|
|
329
|
|
|
5
|
14
|
|
|
14
|
|
83
|
use warnings; |
|
|
14
|
|
|
|
|
30
|
|
|
|
14
|
|
|
|
|
8738
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
1
|
1177
|
sub description { 'Unknown MTA #6' } |
|
8
|
|
|
|
|
|
|
sub make { |
|
9
|
|
|
|
|
|
|
# Detect an error from Unknown MTA #6 |
|
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 parse or the arguments are missing |
|
14
|
|
|
|
|
|
|
# @since v4.25.6 |
|
15
|
193
|
|
|
193
|
1
|
630
|
my $class = shift; |
|
16
|
193
|
|
100
|
|
|
452
|
my $mhead = shift // return undef; |
|
17
|
192
|
|
50
|
|
|
435
|
my $mbody = shift // return undef; |
|
18
|
192
|
100
|
|
|
|
641
|
return undef unless index($mhead->{'subject'}, 'There was an error sending your mail') == 0; |
|
19
|
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
85
|
state $indicators = __PACKAGE__->INDICATORS; |
|
21
|
11
|
|
|
|
|
35
|
state $rebackbone = qr/^The attachment contains the original mail headers.+$/m; |
|
22
|
11
|
|
|
|
|
38
|
state $markingsof = { 'message' => qr/\A\d+[ ]*error[(]s[)]:/ }; |
|
23
|
|
|
|
|
|
|
|
|
24
|
11
|
|
|
|
|
46
|
my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; |
|
25
|
11
|
|
|
|
|
89
|
my $emailsteak = Sisimai::RFC5322->fillet($mbody, $rebackbone); |
|
26
|
11
|
|
|
|
|
39
|
my $readcursor = 0; # (Integer) Points the current cursor position |
|
27
|
11
|
|
|
|
|
34
|
my $recipients = 0; # (Integer) The number of 'Final-Recipient' header |
|
28
|
11
|
|
|
|
|
30
|
my $v = undef; |
|
29
|
|
|
|
|
|
|
|
|
30
|
11
|
|
|
|
|
84
|
for my $e ( split("\n", $emailsteak->[0]) ) { |
|
31
|
|
|
|
|
|
|
# Read error messages and delivery status lines from the head of the email |
|
32
|
|
|
|
|
|
|
# to the previous line of the beginning of the original message. |
|
33
|
110
|
100
|
|
|
|
167
|
unless( $readcursor ) { |
|
34
|
|
|
|
|
|
|
# Beginning of the bounce message or message/delivery-status part |
|
35
|
88
|
100
|
|
|
|
295
|
$readcursor |= $indicators->{'deliverystatus'} if $e =~ $markingsof->{'message'}; |
|
36
|
88
|
|
|
|
|
118
|
next; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
22
|
50
|
|
|
|
76
|
next unless $readcursor & $indicators->{'deliverystatus'}; |
|
39
|
22
|
100
|
|
|
|
66
|
next unless length $e; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# 1 error(s): |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# SMTP Server rejected recipient |
|
44
|
|
|
|
|
|
|
# (Error following RCPT command). It responded as follows: [550 5.1.1 User unknown] |
|
45
|
11
|
|
|
|
|
24
|
$v = $dscontents->[-1]; |
|
46
|
11
|
50
|
66
|
|
|
114
|
if( $e =~ /<([^ @]+[@][^ @]+)>/ || $e =~ /errors:[ ]*([^ ]+[@][^ ]+)/ ) { |
|
47
|
|
|
|
|
|
|
# SMTP Server rejected recipient |
|
48
|
|
|
|
|
|
|
# The following recipients returned permanent errors: neko@example.jp. |
|
49
|
11
|
50
|
|
|
|
41
|
if( $v->{'recipient'} ) { |
|
50
|
|
|
|
|
|
|
# There are multiple recipient addresses in the message body. |
|
51
|
0
|
|
|
|
|
0
|
push @$dscontents, __PACKAGE__->DELIVERYSTATUS; |
|
52
|
0
|
|
|
|
|
0
|
$v = $dscontents->[-1]; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
11
|
|
|
|
|
77
|
$v->{'recipient'} = Sisimai::Address->s3s4($1); |
|
55
|
11
|
|
|
|
|
37
|
$v->{'diagnosis'} = $e; |
|
56
|
11
|
|
|
|
|
48
|
$recipients++; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
11
|
50
|
|
|
|
64
|
return undef unless $recipients; |
|
60
|
|
|
|
|
|
|
|
|
61
|
11
|
|
|
|
|
43
|
for my $e ( @$dscontents ) { |
|
62
|
|
|
|
|
|
|
# Get the last SMTP command from the error message |
|
63
|
11
|
50
|
|
|
|
135
|
if( $e->{'diagnosis'} =~ /\b(HELO|EHLO|MAIL|RCPT|DATA)\b/ ) { |
|
64
|
|
|
|
|
|
|
# ...(Error following RCPT command). |
|
65
|
11
|
|
|
|
|
41
|
$e->{'command'} = $1; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
11
|
|
|
|
|
77
|
$e->{'diagnosis'} = Sisimai::String->sweep($e->{'diagnosis'}); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
11
|
|
|
|
|
88
|
return { 'ds' => $dscontents, 'rfc822' => $emailsteak->[1] }; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
|
73
|
|
|
|
|
|
|
__END__ |