| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sisimai::Lhost::X6; |
|
2
|
34
|
|
|
34
|
|
4478
|
use parent 'Sisimai::Lhost'; |
|
|
34
|
|
|
|
|
81
|
|
|
|
34
|
|
|
|
|
269
|
|
|
3
|
34
|
|
|
34
|
|
2949
|
use v5.26; |
|
|
34
|
|
|
|
|
181
|
|
|
4
|
34
|
|
|
34
|
|
177
|
use strict; |
|
|
34
|
|
|
|
|
71
|
|
|
|
34
|
|
|
|
|
1217
|
|
|
5
|
34
|
|
|
34
|
|
196
|
use warnings; |
|
|
34
|
|
|
|
|
85
|
|
|
|
34
|
|
|
|
|
25538
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
1
|
5
|
sub description { 'Unknown MTA #6' } |
|
8
|
|
|
|
|
|
|
sub inquire { |
|
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 decode or the arguments are missing |
|
14
|
|
|
|
|
|
|
# @since v4.25.6 |
|
15
|
868
|
|
|
868
|
1
|
5035
|
my $class = shift; |
|
16
|
868
|
|
100
|
|
|
2669
|
my $mhead = shift // return undef; |
|
17
|
867
|
|
100
|
|
|
2332
|
my $mbody = shift // return undef; |
|
18
|
|
|
|
|
|
|
|
|
19
|
866
|
100
|
|
|
|
2618
|
return undef unless $mhead->{'subject'}; |
|
20
|
849
|
100
|
|
|
|
3767
|
return undef if index($mhead->{'subject'}, 'There was an error sending your mail') != 0; |
|
21
|
|
|
|
|
|
|
|
|
22
|
11
|
|
|
|
|
51
|
state $indicators = __PACKAGE__->INDICATORS; |
|
23
|
11
|
|
|
|
|
25
|
state $boundaries = ['The attachment contains the original mail headers']; |
|
24
|
11
|
|
|
|
|
43
|
state $startingof = {'message' => ['We had trouble delivering your message. Full details follow:']}; |
|
25
|
|
|
|
|
|
|
|
|
26
|
11
|
|
|
|
|
81
|
my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = undef; |
|
|
11
|
|
|
|
|
34
|
|
|
27
|
11
|
|
|
|
|
78
|
my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries); |
|
28
|
11
|
|
|
|
|
31
|
my $readcursor = 0; # (Integer) Points the current cursor position |
|
29
|
11
|
|
|
|
|
26
|
my $recipients = 0; # (Integer) The number of 'Final-Recipient' header |
|
30
|
|
|
|
|
|
|
|
|
31
|
11
|
|
|
|
|
140
|
for my $e ( split("\n", $emailparts->[0]) ) { |
|
32
|
|
|
|
|
|
|
# Read error messages and delivery status lines from the head of the email to the previous |
|
33
|
|
|
|
|
|
|
# line of the beginning of the original message. |
|
34
|
110
|
100
|
|
|
|
257
|
unless( $readcursor ) { |
|
35
|
|
|
|
|
|
|
# Beginning of the bounce message or message/delivery-status part |
|
36
|
33
|
100
|
|
|
|
140
|
$readcursor |= $indicators->{'deliverystatus'} if index($e, $startingof->{'message'}->[0]) == 0; |
|
37
|
33
|
|
|
|
|
75
|
next; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
77
|
100
|
66
|
|
|
300
|
next if ($readcursor & $indicators->{'deliverystatus'}) == 0 || $e eq ""; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# We had trouble delivering your message. Full details follow: |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# Subject: 'Nyaan' |
|
44
|
|
|
|
|
|
|
# Date: 'Thu, 29 Apr 2012 23:34:45 +0000' |
|
45
|
|
|
|
|
|
|
# |
|
46
|
|
|
|
|
|
|
# 1 error(s): |
|
47
|
|
|
|
|
|
|
# |
|
48
|
|
|
|
|
|
|
# SMTP Server rejected recipient |
|
49
|
|
|
|
|
|
|
# (Error following RCPT command). It responded as follows: [550 5.1.1 User unknown] |
|
50
|
44
|
|
|
|
|
71
|
$v = $dscontents->[-1]; |
|
51
|
44
|
|
|
|
|
78
|
my $p1 = index($e, 'The following recipients returned permanent errors: '); |
|
52
|
44
|
|
|
|
|
80
|
my $p2 = index($e, 'SMTP Server <'); |
|
53
|
44
|
100
|
100
|
|
|
249
|
if( $p1 == 0 || $p2 == 0 ) { |
|
54
|
|
|
|
|
|
|
# SMTP Server rejected recipient |
|
55
|
|
|
|
|
|
|
# The following recipients returned permanent errors: neko@example.jp. |
|
56
|
11
|
50
|
|
|
|
42
|
if( $v->{'recipient'} ) { |
|
57
|
|
|
|
|
|
|
# There are multiple recipient addresses in the message body. |
|
58
|
0
|
|
|
|
|
0
|
push @$dscontents, __PACKAGE__->DELIVERYSTATUS; |
|
59
|
0
|
|
|
|
|
0
|
$v = $dscontents->[-1]; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
11
|
100
|
|
|
|
53
|
if( $p1 == 0 ) { |
|
|
|
50
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# The following recipients returned permanent errors: neko@example.jp. |
|
63
|
6
|
|
|
|
|
18
|
$p1 = index($e, 'errors: '); |
|
64
|
6
|
|
|
|
|
16
|
$p2 = index($e, ' ', $p1 + 8); |
|
65
|
6
|
|
|
|
|
81
|
$v->{'recipient'} = Sisimai::Address->s3s4(substr($e, $p1 + 8, $p2 - $p1 - 8)); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} elsif( $p2 == 0 ) { |
|
68
|
|
|
|
|
|
|
# SMTP Server rejected recipient |
|
69
|
5
|
|
|
|
|
15
|
$p1 = rindex($e, '<'); |
|
70
|
5
|
|
|
|
|
16
|
$p2 = rindex($e, '>'); |
|
71
|
5
|
|
|
|
|
64
|
$v->{'recipient'} = Sisimai::Address->s3s4(substr($e, $p1, $p2 - $p1)); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} else { |
|
74
|
0
|
|
|
|
|
0
|
next; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
11
|
|
|
|
|
45
|
$v->{'diagnosis'} = $e; |
|
77
|
11
|
|
|
|
|
28
|
$recipients++; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
11
|
50
|
|
|
|
58
|
return undef unless $recipients; |
|
81
|
|
|
|
|
|
|
|
|
82
|
11
|
|
|
|
|
77
|
require Sisimai::SMTP::Command; |
|
83
|
11
|
|
|
|
|
52
|
for my $e ( @$dscontents ) { |
|
84
|
|
|
|
|
|
|
# Get the last SMTP command from the error message |
|
85
|
11
|
50
|
|
|
|
130
|
if( my $cv = Sisimai::SMTP::Command->find($e->{'diagnosis'}) ) { |
|
86
|
|
|
|
|
|
|
# ...(Error following RCPT command). |
|
87
|
11
|
|
|
|
|
46
|
$e->{'command'} = $cv; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
11
|
|
|
|
|
88
|
$e->{'diagnosis'} = Sisimai::String->sweep($e->{'diagnosis'}); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
11
|
|
|
|
|
80
|
return {"ds" => $dscontents, "rfc822" => $emailparts->[1]}; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
__END__ |