Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go sisimai compatibility 7e8b #558

Merged
merged 172 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
d7da47b
Implement Sisimai::Reason::Suppressed sisimai/go-sisimai#18
azumakuniyuki Nov 25, 2024
b7a0b1d
Add "exceeded the maximum incoming message size" into Sisimai::Reason…
azumakuniyuki Nov 25, 2024
17c60cc
Remove "hardbounce" accessor from Sisimai::Lhost #555
azumakuniyuki Nov 25, 2024
a2ede0f
Sisimai::RFC1894->field() returns an array which have 5 elements: [Fi…
azumakuniyuki Nov 26, 2024
7362aac
Implement Sisimai::RFC3464::ThirdParty #551
azumakuniyuki Nov 26, 2024
f5a64ba
Use [3] to refer the 4th element of the value returned by Sisimai::RF…
azumakuniyuki Nov 27, 2024
c5d9660
Disable 37,38, and 39 https://github.com/sisimai/set-of-emails/issues/27
azumakuniyuki Nov 27, 2024
ca033f0
Disabled bounce mails have been moved to set-of-email/maildir/tmp htt…
azumakuniyuki Nov 27, 2024
8f7bada
Remove the test results of removed emails ca033f08 https://github.com…
azumakuniyuki Nov 27, 2024
0cd8c4e
Disable many bounce mails of RFC3464 in the private sample https://gi…
azumakuniyuki Nov 27, 2024
3f45b0c
Enable rfc3464/01003 https://github.com/sisimai/set-of-emails/issues/27
azumakuniyuki Nov 27, 2024
81feb9d
Add "Not enough disk space" (rfc3464-01.eml) into Sisimai::Reason::Ma…
azumakuniyuki Nov 27, 2024
f2c2826
Update the number of emails https://github.com/sisimai/set-of-emails/…
azumakuniyuki Nov 27, 2024
0f090ea
Sisimai::RFC3464 now can decode a bounce mail generated by Amavis #557
azumakuniyuki Nov 27, 2024
bd4a194
Remove Sisimai::Lhost::Amavis from each list #557 0f090ea9
azumakuniyuki Nov 27, 2024
4a19a38
Sisimai::RFC3464 now can decode a bounce mail generated by Barracuda …
azumakuniyuki Nov 27, 2024
4bc6dad
Import commit sisimai/go-sisimai@bba6f9d, Bug fix and code improvemen…
azumakuniyuki Nov 28, 2024
f8048e5
Import commit https://github.com/sisimai/go-sisimai/commit/286741382e…
azumakuniyuki Nov 28, 2024
f87f7e4
Sisimai::RFC3464 now can decode a bounce mail generated by Bigfoot #557
azumakuniyuki Nov 29, 2024
bcae331
Sisimai::RFC3464 now can decode a bounce mail generated by PowerMTA #557
azumakuniyuki Nov 29, 2024
222bec9
Add a comment inside of $boundaries, bug fix for checking RFC3464 field
azumakuniyuki Nov 29, 2024
deb149c
Sisimai::RFC3464 now can decode a bounce mail generated by ReceivingS…
azumakuniyuki Nov 29, 2024
16cabc1
Sisimai::RFC3464 now can decode a bounce mail generated by SendGrid #557
azumakuniyuki Nov 29, 2024
9dc6552
Sisimai::RFC3464 now can decode a bounce mail generated by SurfContro…
azumakuniyuki Nov 29, 2024
3b9b576
Sisimai::RFC3464 now can decode a bounce mail generated by Yandex #557
azumakuniyuki Nov 30, 2024
dff23d7
Sisimai::RFC3464 now can decode a bounce mail generated by X5 #557
azumakuniyuki Nov 30, 2024
00c8d84
Code improvement: https://github.com/sisimai/go-sisimai/commit/e4a8fb…
azumakuniyuki Nov 30, 2024
4138c7a
Fix/Update the results of test for PowerMTA #557
azumakuniyuki Nov 30, 2024
b92deef
Implement code for checking "deliverystatus" value and the current re…
azumakuniyuki Dec 1, 2024
1668101
Add new error message pattern: "message filtered" (Filtered)
azumakuniyuki Dec 1, 2024
0528b24
Change the order of $ClassOrder->[0] #557
azumakuniyuki Dec 1, 2024
4740257
Fix/Update the result table for SendGrid 16cabc1e1ddd0cab9f4dc3c45d3e…
azumakuniyuki Dec 1, 2024
2c7e93f
Fix/Update the result table for ReceivingSES #557 deb149cb1ceddaf2a60…
azumakuniyuki Dec 1, 2024
7c61fdb
Rename lhost-aol to rhost-aol #557
azumakuniyuki Dec 1, 2024
27d9056
Rename lhost-aol to rhost-aol #557
azumakuniyuki Dec 1, 2024
543de5a
Fix hostnames end with "example.com"
azumakuniyuki Dec 1, 2024
4d5ec60
Implement Sisimai::Rhost::Aol #559
azumakuniyuki Dec 1, 2024
a3ca016
Sisimai::RFC3464 now can decode a bounce mail generated by Aol #557 4…
azumakuniyuki Dec 1, 2024
e48a577
Import commit https://github.com/sisimai/go-sisimai/commit/f5c042a2b2…
azumakuniyuki Dec 1, 2024
b955efc
Early return #559
azumakuniyuki Dec 1, 2024
9ca5406
Early return() at each module in Sisimai::Rhost
azumakuniyuki Dec 1, 2024
40d1cc7
Fix URL in the POD
azumakuniyuki Dec 1, 2024
a537097
Sisimai::RFC3464 now can decode a bounce mail generated by Facebook #…
azumakuniyuki Dec 1, 2024
288d38a
Rename lhost-gsuite to rhost-gsuite #557 #559
azumakuniyuki Dec 1, 2024
66c0e54
Sisimai::Lhost::GoogleGroups requires "Google Groups" in the message …
azumakuniyuki Dec 2, 2024
f2d7f68
Replace "," just after an IPv4 address with a space character
azumakuniyuki Dec 2, 2024
c356b51
Sisimai::RFC3464 now can decode a bounce mail generated by GSuite #55…
azumakuniyuki Dec 2, 2024
5fe95b1
Sisimai::RFC3464 now can decode a bounce mail generated by MessageLab…
azumakuniyuki Dec 2, 2024
69e8757
Remove Sisimai::Lhost::MessageLabs #557 5fe95b1d
azumakuniyuki Dec 2, 2024
2ccbe93
Sisimai::RFC3464 now can decode a bounce mail generated by Microsoft …
azumakuniyuki Dec 2, 2024
fd8f0a5
Implement Sisimai::Rhost::Outlook 2ccbe933 #557 #559
azumakuniyuki Dec 2, 2024
96ffefa
Restore Sisimai::Lhost::GSuite as GoogleWorkspace #557 #559
azumakuniyuki Dec 3, 2024
33f93b8
Update tests for Sisimai::Rhost #559
azumakuniyuki Dec 3, 2024
a6fb5d5
lhost-googlegroups-15.eml has been renamed to lhost-googleworkspace-0…
azumakuniyuki Dec 3, 2024
b761d12
The correct reason of lhost-postfix-39.eml is "contenterror" because …
azumakuniyuki Dec 4, 2024
20843f6
Sisimai::MDA has been renamed and implemented again as Sisimai::LDA, …
azumakuniyuki Dec 4, 2024
a79c0ed
Fix the key name of "smtpcommand"
azumakuniyuki Dec 4, 2024
a5211de
Implement Sisimai::Reason->is_explicit(), import commit https://githu…
azumakuniyuki Dec 4, 2024
759bee4
The reason of rhost-franceptt-10,11 is "blocked", it is decided by "H…
azumakuniyuki Dec 4, 2024
ee3731b
Require modules used in each code
azumakuniyuki Dec 4, 2024
f4181be
lhost-amavis-03 bounces due to "duplicate header field" error (means …
azumakuniyuki Dec 4, 2024
b8426c6
Sisimai::RFC1123->is_validhostname has been renamed to is_internethost()
azumakuniyuki Dec 5, 2024
8f034f6
Update the method name (is_internethost()) b8426c69fcea39ed7aa68837c3…
azumakuniyuki Dec 6, 2024
b8c5f44
Add error message for sv-SE
azumakuniyuki Dec 6, 2024
18190cc
Implement Sisimai::RFC1123->find(), imported from https://github.com/…
azumakuniyuki Dec 6, 2024
73fa40a
Assign "blocked" to the status code "4.2.1", Select the preferred sta…
azumakuniyuki Dec 6, 2024
b8dd438
Sisimai::Lhost::AmazonSES now decodes only JSON formatted bounce retu…
azumakuniyuki Dec 6, 2024
ab27ccb
undef is not allowed as a value of "action"
azumakuniyuki Dec 6, 2024
79ab882
Bug fix for the case of 2 or more ";" characters in Diagnostic-Code: …
azumakuniyuki Dec 6, 2024
efe4027
Do not override the SMTP command found first, import commit sisimai/g…
azumakuniyuki Dec 6, 2024
0c8a44e
Condition improvement in Sisimai::STMP::Status->prefer(), import comm…
azumakuniyuki Dec 6, 2024
cc3e2e0
Fix $actionlist, import commit sisimai/go-sisimai@5983471
azumakuniyuki Dec 6, 2024
d0b68dc
Remove debug code in a comment
azumakuniyuki Dec 6, 2024
6c76abf
Fix the results of some bounce reasons, smtp status codes
azumakuniyuki Dec 6, 2024
fd77e23
Update lhost-code for removed modules in Sisimai::Lhost::* #557
azumakuniyuki Dec 7, 2024
85a02e2
Code improvement in Sisimai::Rhost->find(), import commit sisimai/go-…
azumakuniyuki Dec 7, 2024
f24188b
Bug fix
azumakuniyuki Dec 7, 2024
50b390c
All private samples in lhost-gsuite have been moved to rfc3464/ excep…
azumakuniyuki Dec 8, 2024
579b506
lhost-gsite/01002 has been moved to lhsot-googleworkspace/01002 50b390ce
azumakuniyuki Dec 8, 2024
cafe24b
lhost-gsite/01002 has been moved to lhsot-googleworkspace/01002 50b390ce
azumakuniyuki Dec 8, 2024
d81aafc
The maximum length of the top level domain is 63 (https://www.rfc-edi…
azumakuniyuki Dec 8, 2024
72fd30b
lhost-office365/1026 has been moved to rfc3464/1311
azumakuniyuki Dec 8, 2024
35abac0
Tune the results of decoding for Amavis, Exim
azumakuniyuki Dec 8, 2024
fc5f828
Some private samples in lhost-domino, lhost-office365 have been moved…
azumakuniyuki Dec 8, 2024
38206b8
Try to match with error message patterns defined in sisimai/reason/sp…
azumakuniyuki Dec 8, 2024
14e1528
Add a new error message patterns: "Mail score (22) ..."
azumakuniyuki Dec 8, 2024
6a45128
Fix the bounce reason for Amavis
azumakuniyuki Dec 8, 2024
fe29133
Fix the bounce reason for Amavis
azumakuniyuki Dec 8, 2024
3c484a5
Error message indicates "SpamDetected"
azumakuniyuki Dec 8, 2024
5bb1569
Set "mailererror" when the error message did not matched with any pat…
azumakuniyuki Dec 9, 2024
09e9e8c
Add a part of error message pattern: "550 Your access IP to this e-ma…
azumakuniyuki Dec 9, 2024
e3db195
Try to match with error message patterns defined in Sisimai::Reason::…
azumakuniyuki Dec 9, 2024
46ef32b
Add an error message pattern of procmail: "User over quota", import c…
azumakuniyuki Dec 9, 2024
d62e327
Add 5 boundary strings devide into the bounce message and the origina…
azumakuniyuki Dec 9, 2024
e54a851
Fix the result for qmail d62e327f
azumakuniyuki Dec 9, 2024
ed03c6a
Tiny code improvement for finding a remote hostname
azumakuniyuki Dec 9, 2024
26d9885
Fix the results for SendGrid
azumakuniyuki Dec 9, 2024
0e31a63
Set "delivered" into "action" when the "reason" is "delivered", impor…
azumakuniyuki Dec 9, 2024
f978f61
Private sample lhost-sendmail/1229 has been moved to rfc3464/1318
azumakuniyuki Dec 9, 2024
a14040e
Private sample lhost-sendmail/1229 has been moved to rfc3464/1318 f97…
azumakuniyuki Dec 9, 2024
7fff79e
Add a code to fix a malformed Final-Recipient field, import commit si…
azumakuniyuki Dec 9, 2024
cdd2c82
The value of "reason" is "onhold" when there is an error message in "…
azumakuniyuki Dec 9, 2024
aa87422
Bug fix: typo key name for "alias"
azumakuniyuki Dec 9, 2024
9b32878
Replace "Content-Type: message/disposition-notification" with "messag…
azumakuniyuki Dec 9, 2024
a254129
The value of "reason" is "onhold" when there is an error message in "…
azumakuniyuki Dec 9, 2024
a53bdef
Add "unable to connect to avp daemon:" as an error message pattern in…
azumakuniyuki Dec 9, 2024
251f89d
Private sample rfc3464/1124 is "systemerror" a53bdefe
azumakuniyuki Dec 9, 2024
ff39e92
Bug fix, Set the captured and s3s4ed address into "recipient"
azumakuniyuki Dec 9, 2024
4412ed8
The value of "reason" is "onhold" when there is an error message in "…
azumakuniyuki Dec 9, 2024
07b00e5
Private sampel rfc3464/1233 is "systemerror"
azumakuniyuki Dec 10, 2024
7abf169
Private sample rfc3464/1277(2) is "networkerror"
azumakuniyuki Dec 10, 2024
9f14629
Make Sisimai::SMTP::Reply->find() more stable, import commit sisimai/…
azumakuniyuki Dec 10, 2024
2c1aa39
The value of "reason" is "onhold" when there is an error message in "…
azumakuniyuki Dec 10, 2024
61cc388
Fix the reply code of lhost-exim/1154
azumakuniyuki Dec 10, 2024
dcc9ed5
#554 Disable rfc3464/1227
azumakuniyuki Dec 10, 2024
c74e553
Sisimai::Lhost::Exim now can decode a bounce mail generated by mail.r…
azumakuniyuki Dec 11, 2024
ea52ec4
Remove malformed bounce mail (Exim) https://github.com/sisimai/set-of…
azumakuniyuki Dec 11, 2024
f06fa03
Sisimai::Lhost::Exim now can decode a bounce mail generated by MXLogi…
azumakuniyuki Dec 11, 2024
3d9f040
Fix code for setting module name (removed) #557
azumakuniyuki Dec 11, 2024
6aeb4f2
lhost-x4-08 has been renamed to lhost-x2-06.eml
azumakuniyuki Dec 11, 2024
444071b
Large scale code improvement in Sisimai::Lhost::qmail, import from ht…
azumakuniyuki Dec 11, 2024
f30b027
Remove private samples which are not a qmail-clone https://github.com…
azumakuniyuki Dec 11, 2024
f7126b9
Sisimai::Lhost::qmail now can decode a bounce mail generated by X4 #557
azumakuniyuki Dec 11, 2024
786d420
Strictly checks the ascii code of characters, import commit sisimai/g…
azumakuniyuki Dec 12, 2024
b49963e
Sisimai::Lhost::qmail now can decode a bounce mail generated by Yahoo…
azumakuniyuki Dec 12, 2024
b2d541c
Tiny code improvement in Sisimai::Order
azumakuniyuki Dec 12, 2024
2a9e90d
The order of MTA module has been changed
azumakuniyuki Dec 12, 2024
be099e3
Fix the method comment (Sisimai::RFC1123->find())
azumakuniyuki Dec 12, 2024
93f0242
Tiny indentation improvement
azumakuniyuki Dec 12, 2024
e310f18
Alphabetical order
azumakuniyuki Dec 12, 2024
5ee4e5b
Tiny code improvement in Sisimai::Lhost::Domino
azumakuniyuki Dec 13, 2024
41524a8
Sisimai::RFC3464 now can decode a bounce mail generated by McAfee #557
azumakuniyuki Dec 13, 2024
116b000
Sisimai::RFC3464 now can decode a bounce mail generated by Amazon Wor…
azumakuniyuki Dec 13, 2024
a9ac4c9
Alphabetical order in error message patterns
azumakuniyuki Dec 13, 2024
75b6fde
Tiny test improvement
azumakuniyuki Dec 13, 2024
5d1c54d
Change the order of variables
azumakuniyuki Dec 13, 2024
93fa081
Remove the blank line
azumakuniyuki Dec 13, 2024
c872e03
Remove `last;` in a comment
azumakuniyuki Dec 15, 2024
36d0d25
Tiny code improvement
azumakuniyuki Dec 15, 2024
53f064f
Remove useless condition from Sisimai::Lhost::GoogleWorkspace
azumakuniyuki Dec 16, 2024
35a117e
Fix the comment in Sisimai::Lhost::GoogleWorkspace
azumakuniyuki Dec 16, 2024
569b622
Remove unused variable $v
azumakuniyuki Dec 16, 2024
fd6396a
Remove redundant condition
azumakuniyuki Dec 16, 2024
f8906dc
Remove redundant space characters
azumakuniyuki Dec 16, 2024
3a3cb9d
Update comments: There is no regular expression in Sisimai::Lhost::Exim
azumakuniyuki Dec 16, 2024
f2a7893
Update the order of Lhost modules
azumakuniyuki Dec 16, 2024
2b590af
Remove a variable "$nt" (not used)
azumakuniyuki Dec 16, 2024
da2dcb3
Remove useless condition: not needed to check `"Message"` string
azumakuniyuki Dec 16, 2024
54b87be
Code improvement for loading JSON
azumakuniyuki Dec 16, 2024
1d1ae02
Code improvement in Sisimai::ARF->is_arf()
azumakuniyuki Dec 17, 2024
0f21861
Do not forget the modulename (ARF)
azumakuniyuki Dec 17, 2024
ca1361a
Import all the codes from https://github.com/sisimai/go-sisimai/blob/…
azumakuniyuki Dec 17, 2024
0633384
Agent name is "ARF" ca1361af
azumakuniyuki Dec 17, 2024
f6261da
Some emails which have no "Content-Type: message/feedback-report" fie…
azumakuniyuki Dec 17, 2024
de3d8b2
Remove unused variable: $longfields
azumakuniyuki Dec 17, 2024
e5d88d4
break???
azumakuniyuki Dec 17, 2024
9afc487
Tiny code improvement for dealing alternative error message
azumakuniyuki Dec 17, 2024
9518b60
Tiny code improvement for dealing alternative error message
azumakuniyuki Dec 17, 2024
3e11f56
lhost-exim-07.eml come back
azumakuniyuki Dec 17, 2024
61a8078
Some email samples for GoogleWorkspace have been moved to rfc3464-*
azumakuniyuki Dec 17, 2024
9ee99e3
Remove a leading space character
azumakuniyuki Dec 17, 2024
e37d755
Bug fix for getting an alias address in Sisimai::Lhost::Exim
azumakuniyuki Dec 18, 2024
6fbbdc2
Code improvement for getting error messages from Exim, import commit …
azumakuniyuki Dec 18, 2024
b5f3c67
Code improvement in Sisimai::Lhost::EZweb
azumakuniyuki Dec 18, 2024
d093611
Large scale improvement for decoding bounce mails returned from EZweb
azumakuniyuki Dec 18, 2024
7a2acc1
Some private samples in RFC3464 are decoded by Exchange2007
azumakuniyuki Dec 18, 2024
edabc1b
Sisimai::Lhost::Exchange2007 now can decode a bounce mail generated b…
azumakuniyuki Dec 19, 2024
f5fb0f5
Some private samples are temporary diabled for makking test pass
azumakuniyuki Dec 19, 2024
f914054
Variable name changed: $q => $cv
azumakuniyuki Dec 19, 2024
922f50b
Code improvement, import commit https://github.com/sisimai/go-sisimai…
azumakuniyuki Dec 19, 2024
d2243af
Disable 2 private samples for ApacheJames (there is no valid email ad…
azumakuniyuki Dec 19, 2024
a208738
No need to convert "-" to "/" at ISO8601 date format
azumakuniyuki Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 122 additions & 211 deletions lib/Sisimai/ARF.pm

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions lib/Sisimai/Fact.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use Sisimai::SMTP::Command;
use Sisimai::SMTP::Failure;
use Sisimai::String;
use Sisimai::Rhost;
use Sisimai::LDA;
use Class::Accessor::Lite ('new' => 0, 'rw' => [
'action', # [String] The value of Action: header
'addresser', # [Sisimai::Address] From address
Expand Down Expand Up @@ -156,11 +157,19 @@ sub rise {
my $recv = $mesg1->{'header'}->{'received'} || [];
unless( $piece->{'rhost'} ) {
# Try to pick a remote hostname from Received: headers of the bounce message
for my $re ( reverse @$recv ) {
# Check the Received: headers backwards and get a remote hostname
my $cv = Sisimai::RFC5322->received($re)->[0];
next unless Sisimai::RFC1123->is_validhostname($cv);
$piece->{'rhost'} = $cv; last;
my $ir = Sisimai::RFC1123->find($e->{'diagnosis'});
$piece->{'rhost'} = $ir if Sisimai::RFC1123->is_internethost($ir);

unless( $piece->{'rhost'} ) {
# The remote hostname in the error message did not exist or is not a valid
# internet hostname
for my $re ( reverse @$recv ) {
# Check the Received: headers backwards and get a remote hostname
last if $piece->{'rhost'};
my $cv = Sisimai::RFC5322->received($re)->[0];
next unless Sisimai::RFC1123->is_internethost($cv);
$piece->{'rhost'} = $cv;
}
}
}
$piece->{'lhost'} = '' if $piece->{'lhost'} eq $piece->{'rhost'};
Expand All @@ -170,7 +179,7 @@ sub rise {
for my $le ( @$recv ) {
# Check the Received: headers forwards and get a local hostname
my $cv = Sisimai::RFC5322->received($le)->[0];
next unless Sisimai::RFC1123->is_validhostname($cv);
next unless Sisimai::RFC1123->is_internethost($cv);
$piece->{'lhost'} = $cv; last;
}
}
Expand Down Expand Up @@ -308,7 +317,7 @@ sub rise {
my $ar = Sisimai::Address->new({'address' => $piece->{'recipient'}}) || next RISEOF;
my @ea = (qw|
action deliverystatus diagnosticcode diagnostictype feedbacktype lhost listid
messageid origin reason replycode rhost smtpagent smtpcommand subject
messageid origin reason replycode rhost smtpagent smtpcommand subject
|);

$thing = {
Expand Down Expand Up @@ -356,7 +365,11 @@ sub rise {
if( $thing->{'reason'} eq '' || exists $retryindex->{ $thing->{'reason'} } ) {
# The value of "reason" is empty or is needed to check with other values again
my $re = $thing->{'reason'} || 'undefined';
$thing->{'reason'} = Sisimai::Rhost->find($thing) || Sisimai::Reason->find($thing) || $re;
my $cr = "Sisimai::Reason";
my $or = Sisimai::LDA->find($thing); if( $cr->is_explicit($or) ){ $thing->{'reason'} = $or; last }
$or = Sisimai::Rhost->find($thing); if( $cr->is_explicit($or) ){ $thing->{'reason'} = $or; last }
$or = Sisimai::Reason->find($thing); if( $cr->is_explicit($or) ){ $thing->{'reason'} = $or; last }
$thing->{'reason'} = $thing->{'diagnosticcode'} ? "onhold" : $re;
}
}

Expand Down Expand Up @@ -406,8 +419,10 @@ sub rise {
$thing->{'action'} = $ox->[2];
}
}
$thing->{'action'} = 'delayed' if $thing->{'reason'} eq 'expired';
$thing->{'action'} ||= 'failed' if $cx->[0] eq '4' || $cx->[0] eq '5';
$thing->{'action'} = 'delivered' if $thing->{'reason'} eq 'delivered';
$thing->{'action'} ||= 'delayed' if $thing->{'reason'} eq 'expired';
$thing->{'action'} ||= 'failed' if $cx->[0] eq '4' || $cx->[0] eq '5';
$thing->{'action'} ||= "";
}

push @$listoffact, bless($thing, __PACKAGE__);
Expand Down
135 changes: 135 additions & 0 deletions lib/Sisimai/LDA.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package Sisimai::LDA;
use v5.26;
use strict;
use warnings;

state $LocalAgent = {
# Each error message should be a lower-cased string
# dovecot/src/deliver/deliver.c
# 11: #define DEFAULT_MAIL_REJECTION_HUMAN_REASON \
# 12: "Your message to <%t> was automatically rejected:%n%r"
"dovecot" => ["Your message to ", " was automatically rejected:"],
"mail.local" => ["mail.local: "],
"procmail" => ["procmail: ", "/procmail "],
"maildrop" => ["maildrop: "],
"vpopmail" => ["vdelivermail: "],
"vmailmgr" => ["vdeliver: "],
};

state $MessagesOf = {
# Each error message should be a lower-cased string
"dovecot" => {
# dovecot/src/deliver/mail-send.c:94
"mailboxfull" => [
"not enough disk space",
"quota exceeded", # Dovecot 1.2 dovecot/src/plugins/quota/quota.c
"quota exceeded (mailbox for user is full)", # dovecot/src/plugins/quota/quota.c
],
"userunknown" => ["mailbox doesn't exist: "],
},
"mail.local" => {
"mailboxfull" => ["disc quota exceeded", "mailbox full or quota exceeded"],
"systemerror" => ["temporary file write error"],
"userunknown" => [
": invalid mailbox path",
": unknown user:",
": user missing home directory",
": user unknown",
],
},
"procmail" => {
"mailboxfull" => ["quota exceeded while writing", "user over quota"],
"systemerror" => ["service unavailable"],
"systemfull" => ["no space left to finish writing"],
},
"maildrop" => {
"mailboxfull" => ["maildir over quota."],
"userunknown" => ["invalid user specified.", "cannot find system user"],
},
"vpopmail" => {
"filtered" => ["user does not exist, but will deliver to "],
"mailboxfull" => ["domain is over quota", "user is over quota"],
"suspend" => ["account is locked email bounced"],
"userunknown" => ["sorry, no mailbox here by that name."],
},
"vmailmgr" => {
"mailboxfull" => ["delivery failed due to system quota violation"],
"userunknown" => [
"invalid or unknown base user or domain",
"invalid or unknown virtual user",
"user name does not refer to a virtual user"
],
},
};

sub find {
# Decode the message body and return a bounce reason detected by the error message of LDA
# @param [Sisimai::Fact] argvs Decoded email object
# @return [String] The value of bounce reason
my $class = shift;
my $argvs = shift // return undef;

return "" unless length $argvs->{"diagnosticcode"};
return "" unless $argvs->{"smtpcommand"} eq "" || $argvs->{"smtpcommand"} eq "DATA";

my $deliversby = ""; # [String] Local Delivery Agent name
my $reasontext = ""; # [String] Detected bounce reason
my $issuedcode = lc $argvs->{"diagnosticcode"};

for my $e ( keys %$LocalAgent ) {
# Find a local delivery agent name from the lower-cased error message
next unless grep { index($issuedcode, $_) > -1 } $LocalAgent->{ $e }->@*;
$deliversby = $e; last;
}
return "" unless $deliversby;

for my $e ( keys $MessagesOf->{ $deliversby }->%* ) {
# The key nane is a bounce reason name
next unless grep { index($issuedcode, $_) > -1 } $MessagesOf->{ $deliversby }->{ $e }->@*;
$reasontext = $e; last;
}

$reasontext ||= "mailererror"; # procmail: Couldn't create "/var/mail/tmp.nekochan.22"
return $reasontext;
}

1;
__END__

=encoding utf-8

=head1 NAME

Sisimai::LDA - Error message decoder for LDA; Local Delivery Agent

=head1 SYNOPSIS

use Sisimai::LDA;
my $fact = Sisimai::Fact->rise($v);
my $ldav = Sisimai::LDA->find($fact->[0]); # Returns the bounce reason LDA generated

=head1 DESCRIPTION

C<Sisimai::LDA> decodes bounced email which created by some LDA, such as Dovecot, C<mail.local>,
C<procmail>, and so on. This class is called from C<Sisimai::Fact> only.

=head1 CLASS METHODS

=head2 C<B<find(I<Sisimai::Fact Object>)>>

C<find()> method detects the bounce reason using the error message generated by LDA

=head1 AUTHOR

azumakuniyuki

=head1 COPYRIGHT

Copyright (C) 2014-2016,2018-2024 azumakuniyuki, All rights reserved.

=head1 LICENSE

This software is distributed under The BSD 2-Clause License.

=cut

10 changes: 4 additions & 6 deletions lib/Sisimai/Lhost.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ sub DELIVERYSTATUS {
'replycode', => '', # SMTP Reply Code
'diagnosis' => '', # The value of Diagnostic-Code header
'recipient' => '', # The value of Final-Recipient header
'hardbounce' => '', # Hard bounce or not
'feedbacktype' => '', # Feedback Type
};
}
Expand All @@ -41,11 +40,10 @@ sub index {
# Alphabetical sorted MTA module list
# @return [Array] MTA list with order
return [qw|
Activehunter Amavis AmazonSES AmazonWorkMail Aol ApacheJames Barracuda Bigfoot Biglobe Courier
Domino DragonFly EZweb EinsUndEins Exchange2003 Exchange2007 Exim FML Facebook GMX GSuite GoogleGroups
Gmail IMailServer InterScanMSS KDDI MXLogic MailFoundry MailMarshalSMTP MailRu McAfee MessageLabs
MessagingServer Notes Office365 OpenSMTPD Outlook Postfix PowerMTA ReceivingSES SendGrid Sendmail
SurfControl V5sendmail Verizon X1 X2 X3 X4 X5 X6 Yahoo Yandex Zoho mFILTER qmail
Activehunter AmazonSES ApacheJames Biglobe Courier Domino DragonFly EZweb
EinsUndEins Exchange2003 Exchange2007 Exim FML GMX GoogleGroups GoogleWorkspace Gmail
IMailServer InterScanMSS KDDI MailFoundry MailMarshalSMTP MessagingServer Notes
OpenSMTPD Postfix Sendmail V5sendmail Verizon X1 X2 X3 X6 Zoho mFILTER qmail
|];
}

Expand Down
Loading
Loading