line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sisimai::Order; |
2
|
81
|
|
|
81
|
|
58526
|
use feature ':5.10'; |
|
81
|
|
|
|
|
145
|
|
|
81
|
|
|
|
|
7023
|
|
3
|
81
|
|
|
81
|
|
416
|
use strict; |
|
81
|
|
|
|
|
166
|
|
|
81
|
|
|
|
|
1406
|
|
4
|
81
|
|
|
81
|
|
326
|
use warnings; |
|
81
|
|
|
|
|
131
|
|
|
81
|
|
|
|
|
1877
|
|
5
|
81
|
|
|
81
|
|
24145
|
use Sisimai::Lhost; |
|
81
|
|
|
|
|
191
|
|
|
81
|
|
|
|
|
41309
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub make { |
8
|
|
|
|
|
|
|
# Returns an MTA Order decided by the first word of the "Subject": header |
9
|
|
|
|
|
|
|
# @param [String] argv0 Subject header string |
10
|
|
|
|
|
|
|
# @return [Array] Order of MTA modules |
11
|
|
|
|
|
|
|
# @since v4.25.4 |
12
|
2793
|
|
|
2793
|
0
|
4856
|
my $class = shift; |
13
|
2793
|
|
50
|
|
|
5379
|
my $argv0 = shift || return []; |
14
|
2793
|
|
|
|
|
3706
|
my $first = ''; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# The following order is decided by the first 2 words of Subject: header |
17
|
2793
|
|
|
|
|
7312
|
state $subject = { |
18
|
|
|
|
|
|
|
'abuse-report' => ['Sisimai::ARF'], |
19
|
|
|
|
|
|
|
'auto' => ['Sisimai::RFC3834'], |
20
|
|
|
|
|
|
|
'auto-reply' => ['Sisimai::RFC3834'], |
21
|
|
|
|
|
|
|
'automatic-reply' => ['Sisimai::RFC3834'], |
22
|
|
|
|
|
|
|
'aws-notification' => ['Sisimai::Lhost::AmazonSES'], |
23
|
|
|
|
|
|
|
'complaint-about' => ['Sisimai::ARF'], |
24
|
|
|
|
|
|
|
'delivery-failure' => ['Sisimai::Lhost::Domino', 'Sisimai::Lhost::X2'], |
25
|
|
|
|
|
|
|
'delivery-notification' => ['Sisimai::Lhost::MessagingServer'], |
26
|
|
|
|
|
|
|
'delivery-report' => ['Sisimai::Lhost::PowerMTA'], |
27
|
|
|
|
|
|
|
'delivery-status' => [ |
28
|
|
|
|
|
|
|
'Sisimai::Lhost::GSuite', |
29
|
|
|
|
|
|
|
'Sisimai::Lhost::Outlook', |
30
|
|
|
|
|
|
|
'Sisimai::Lhost::GoogleGroups', |
31
|
|
|
|
|
|
|
'Sisimai::Lhost::McAfee', |
32
|
|
|
|
|
|
|
'Sisimai::Lhost::OpenSMTPD', |
33
|
|
|
|
|
|
|
'Sisimai::Lhost::AmazonSES', |
34
|
|
|
|
|
|
|
'Sisimai::Lhost::AmazonWorkMail', |
35
|
|
|
|
|
|
|
'Sisimai::Lhost::ReceivingSES', |
36
|
|
|
|
|
|
|
'Sisimai::Lhost::Gmail', |
37
|
|
|
|
|
|
|
'Sisimai::Lhost::X3', |
38
|
|
|
|
|
|
|
], |
39
|
|
|
|
|
|
|
'dmarc-ietf-dmarc' => ['Sisimai::ARF'], |
40
|
|
|
|
|
|
|
'email-feedback' => ['Sisimai::ARF'], |
41
|
|
|
|
|
|
|
'failed-delivery' => ['Sisimai::Lhost::X2'], |
42
|
|
|
|
|
|
|
'failure-delivery' => ['Sisimai::Lhost::X2'], |
43
|
|
|
|
|
|
|
'failure-notice' => [ |
44
|
|
|
|
|
|
|
'Sisimai::Lhost::Yahoo', |
45
|
|
|
|
|
|
|
'Sisimai::Lhost::qmail', |
46
|
|
|
|
|
|
|
'Sisimai::Lhost::mFILTER', |
47
|
|
|
|
|
|
|
'Sisimai::Lhost::Activehunter', |
48
|
|
|
|
|
|
|
'Sisimai::Lhost::X4', |
49
|
|
|
|
|
|
|
], |
50
|
|
|
|
|
|
|
'loop-alert' => ['Sisimai::Lhost::FML'], |
51
|
|
|
|
|
|
|
'mail-could' => ['Sisimai::Lhost::InterScanMSS'], |
52
|
|
|
|
|
|
|
'mail-delivery' => [ |
53
|
|
|
|
|
|
|
'Sisimai::Lhost::Exim', |
54
|
|
|
|
|
|
|
'Sisimai::Lhost::MailRu', |
55
|
|
|
|
|
|
|
'Sisimai::Lhost::GMX', |
56
|
|
|
|
|
|
|
'Sisimai::Lhost::EinsUndEins', |
57
|
|
|
|
|
|
|
'Sisimai::Lhost::Zoho', |
58
|
|
|
|
|
|
|
'Sisimai::Lhost::MessageLabs', |
59
|
|
|
|
|
|
|
'Sisimai::Lhost::MXLogic', |
60
|
|
|
|
|
|
|
], |
61
|
|
|
|
|
|
|
'mail-failure' => ['Sisimai::Lhost::Exim'], |
62
|
|
|
|
|
|
|
'mail-not' => ['Sisimai::Lhost::X4'], |
63
|
|
|
|
|
|
|
'mail-system' => ['Sisimai::Lhost::EZweb'], |
64
|
|
|
|
|
|
|
'message-delivery' => ['Sisimai::Lhost::MailFoundry'], |
65
|
|
|
|
|
|
|
'message-frozen' => ['Sisimai::Lhost::Exim'], |
66
|
|
|
|
|
|
|
'message-you' => ['Sisimai::Lhost::Barracuda'], |
67
|
|
|
|
|
|
|
'non-recapitabile' => ['Sisimai::Lhost::Exchange2007'], |
68
|
|
|
|
|
|
|
'non-remis' => ['Sisimai::Lhost::Exchange2007'], |
69
|
|
|
|
|
|
|
'notice' => ['Sisimai::Lhost::Courier'], |
70
|
|
|
|
|
|
|
'permanent-delivery' => ['Sisimai::Lhost::X4'], |
71
|
|
|
|
|
|
|
'postmaster-notify' => ['Sisimai::Lhost::Sendmail'], |
72
|
|
|
|
|
|
|
'returned-mail' => [ |
73
|
|
|
|
|
|
|
'Sisimai::Lhost::Sendmail', |
74
|
|
|
|
|
|
|
'Sisimai::Lhost::Aol', |
75
|
|
|
|
|
|
|
'Sisimai::Lhost::V5sendmail', |
76
|
|
|
|
|
|
|
'Sisimai::Lhost::Bigfoot', |
77
|
|
|
|
|
|
|
'Sisimai::Lhost::Biglobe', |
78
|
|
|
|
|
|
|
'Sisimai::Lhost::X1', |
79
|
|
|
|
|
|
|
], |
80
|
|
|
|
|
|
|
'sorry-your' => ['Sisimai::Lhost::Facebook'], |
81
|
|
|
|
|
|
|
'there-was' => ['Sisimai::Lhost::X6'], |
82
|
|
|
|
|
|
|
'undeliverable' => [ |
83
|
|
|
|
|
|
|
'Sisimai::Lhost::Office365', |
84
|
|
|
|
|
|
|
'Sisimai::Lhost::Exchange2007', |
85
|
|
|
|
|
|
|
'Sisimai::Lhost::Aol', |
86
|
|
|
|
|
|
|
'Sisimai::Lhost::Exchange2003', |
87
|
|
|
|
|
|
|
], |
88
|
|
|
|
|
|
|
'undeliverable-mail' => [ |
89
|
|
|
|
|
|
|
'Sisimai::Lhost::Amavis', |
90
|
|
|
|
|
|
|
'Sisimai::Lhost::MailMarshalSMTP', |
91
|
|
|
|
|
|
|
'Sisimai::Lhost::IMailServer', |
92
|
|
|
|
|
|
|
], |
93
|
|
|
|
|
|
|
'undeliverable-message' => ['Sisimai::Lhost::Notes', 'Sisimai::Lhost::Verizon'], |
94
|
|
|
|
|
|
|
'undelivered-mail' => [ |
95
|
|
|
|
|
|
|
'Sisimai::Lhost::Postfix', |
96
|
|
|
|
|
|
|
'Sisimai::Lhost::Aol', |
97
|
|
|
|
|
|
|
'Sisimai::Lhost::SendGrid', |
98
|
|
|
|
|
|
|
'Sisimai::Lhost::Zoho', |
99
|
|
|
|
|
|
|
], |
100
|
|
|
|
|
|
|
'warning' => ['Sisimai::Lhost::Sendmail', 'Sisimai::Lhost::Exim'], |
101
|
|
|
|
|
|
|
}; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
2793
|
|
|
|
|
4905
|
$argv0 =~ y/_[] / /s; |
105
|
2793
|
|
|
|
|
4531
|
$argv0 =~ s/\A[ ]+//; |
106
|
2793
|
|
|
|
|
7446
|
my @words = split(/[ ]/, lc($argv0), 3); |
107
|
|
|
|
|
|
|
|
108
|
2793
|
100
|
|
|
|
6019
|
if( rindex($words[0], ':') > 0 ) { |
109
|
|
|
|
|
|
|
# Undeliverable: ..., notify: ... |
110
|
203
|
50
|
|
|
|
1388
|
$first = lc $1 if $argv0 =~ /\A(.+?):/; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} else { |
113
|
|
|
|
|
|
|
# Postmaster notify, returned mail, ... |
114
|
2590
|
|
|
|
|
7334
|
$first = join('-', splice(@words, 0, 2)); |
115
|
|
|
|
|
|
|
} |
116
|
2793
|
|
|
|
|
4305
|
$first =~ y/:",*//d; |
117
|
2793
|
|
100
|
|
|
10990
|
return $subject->{ $first } || []; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub default { |
121
|
|
|
|
|
|
|
# Make default order of MTA modules to be loaded |
122
|
|
|
|
|
|
|
# @return [Array] Default order list of MTA modules |
123
|
|
|
|
|
|
|
# @since v4.13.1 |
124
|
1
|
|
|
1
|
1
|
4
|
return [map { 'Sisimai::Lhost::'.$_ } @{ Sisimai::Lhost->index() }]; |
|
55
|
|
|
|
|
75
|
|
|
1
|
|
|
|
|
3
|
|
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub another { |
128
|
|
|
|
|
|
|
# Make MTA modules list as a spare |
129
|
|
|
|
|
|
|
# @return [Array] Ordered module list |
130
|
|
|
|
|
|
|
# @since v4.13.1 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# There are another patterns in the value of "Subject:" header of a bounce mail |
133
|
|
|
|
|
|
|
# generated by the following MTA/ESP modules |
134
|
78
|
|
|
78
|
1
|
599
|
state $orderE0 = [ |
135
|
|
|
|
|
|
|
'Sisimai::Lhost::MailRu', |
136
|
|
|
|
|
|
|
'Sisimai::Lhost::Yandex', |
137
|
|
|
|
|
|
|
'Sisimai::Lhost::Exim', |
138
|
|
|
|
|
|
|
'Sisimai::Lhost::Sendmail', |
139
|
|
|
|
|
|
|
'Sisimai::Lhost::Aol', |
140
|
|
|
|
|
|
|
'Sisimai::Lhost::Office365', |
141
|
|
|
|
|
|
|
'Sisimai::Lhost::Exchange2007', |
142
|
|
|
|
|
|
|
'Sisimai::Lhost::Exchange2003', |
143
|
|
|
|
|
|
|
'Sisimai::Lhost::AmazonWorkMail', |
144
|
|
|
|
|
|
|
'Sisimai::Lhost::AmazonSES', |
145
|
|
|
|
|
|
|
'Sisimai::Lhost::Barracuda', |
146
|
|
|
|
|
|
|
'Sisimai::Lhost::InterScanMSS', |
147
|
|
|
|
|
|
|
'Sisimai::Lhost::KDDI', |
148
|
|
|
|
|
|
|
'Sisimai::Lhost::SurfControl', |
149
|
|
|
|
|
|
|
'Sisimai::Lhost::Verizon', |
150
|
|
|
|
|
|
|
'Sisimai::Lhost::ApacheJames', |
151
|
|
|
|
|
|
|
'Sisimai::Lhost::X2', |
152
|
|
|
|
|
|
|
'Sisimai::Lhost::X5', |
153
|
|
|
|
|
|
|
'Sisimai::Lhost::FML', |
154
|
|
|
|
|
|
|
]; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# Fallback list: The following MTA/ESP modules is not listed orderE0 |
157
|
78
|
|
|
|
|
825
|
state $orderE1 = [ |
158
|
|
|
|
|
|
|
'Sisimai::Lhost::Postfix', |
159
|
|
|
|
|
|
|
'Sisimai::Lhost::GSuite', |
160
|
|
|
|
|
|
|
'Sisimai::Lhost::Yahoo', |
161
|
|
|
|
|
|
|
'Sisimai::Lhost::Outlook', |
162
|
|
|
|
|
|
|
'Sisimai::Lhost::GMX', |
163
|
|
|
|
|
|
|
'Sisimai::Lhost::MessagingServer', |
164
|
|
|
|
|
|
|
'Sisimai::Lhost::EinsUndEins', |
165
|
|
|
|
|
|
|
'Sisimai::Lhost::Domino', |
166
|
|
|
|
|
|
|
'Sisimai::Lhost::Notes', |
167
|
|
|
|
|
|
|
'Sisimai::Lhost::qmail', |
168
|
|
|
|
|
|
|
'Sisimai::Lhost::Courier', |
169
|
|
|
|
|
|
|
'Sisimai::Lhost::OpenSMTPD', |
170
|
|
|
|
|
|
|
'Sisimai::Lhost::Zoho', |
171
|
|
|
|
|
|
|
'Sisimai::Lhost::MessageLabs', |
172
|
|
|
|
|
|
|
'Sisimai::Lhost::MXLogic', |
173
|
|
|
|
|
|
|
'Sisimai::Lhost::MailFoundry', |
174
|
|
|
|
|
|
|
'Sisimai::Lhost::McAfee', |
175
|
|
|
|
|
|
|
'Sisimai::Lhost::V5sendmail', |
176
|
|
|
|
|
|
|
'Sisimai::Lhost::mFILTER', |
177
|
|
|
|
|
|
|
'Sisimai::Lhost::SendGrid', |
178
|
|
|
|
|
|
|
'Sisimai::Lhost::ReceivingSES', |
179
|
|
|
|
|
|
|
'Sisimai::Lhost::Amavis', |
180
|
|
|
|
|
|
|
'Sisimai::Lhost::PowerMTA', |
181
|
|
|
|
|
|
|
'Sisimai::Lhost::GoogleGroups', |
182
|
|
|
|
|
|
|
'Sisimai::Lhost::Gmail', |
183
|
|
|
|
|
|
|
'Sisimai::Lhost::EZweb', |
184
|
|
|
|
|
|
|
'Sisimai::Lhost::IMailServer', |
185
|
|
|
|
|
|
|
'Sisimai::Lhost::MailMarshalSMTP', |
186
|
|
|
|
|
|
|
'Sisimai::Lhost::Activehunter', |
187
|
|
|
|
|
|
|
'Sisimai::Lhost::Bigfoot', |
188
|
|
|
|
|
|
|
'Sisimai::Lhost::Biglobe', |
189
|
|
|
|
|
|
|
'Sisimai::Lhost::Facebook', |
190
|
|
|
|
|
|
|
'Sisimai::Lhost::X4', |
191
|
|
|
|
|
|
|
'Sisimai::Lhost::X1', |
192
|
|
|
|
|
|
|
'Sisimai::Lhost::X3', |
193
|
|
|
|
|
|
|
'Sisimai::Lhost::X6', |
194
|
|
|
|
|
|
|
]; |
195
|
|
|
|
|
|
|
|
196
|
78
|
|
|
|
|
929
|
return [@$orderE0, @$orderE1]; |
197
|
|
|
|
|
|
|
}; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
1; |
200
|
|
|
|
|
|
|
__END__ |