Skip to content

Commit

Permalink
Merge pull request #532 from sisimai/331-tuning-for-notqmail
Browse files Browse the repository at this point in the history
Tuning for notqmail
  • Loading branch information
azumakuniyuki authored Jun 26, 2024
2 parents f38ea1a + 32ba7f8 commit edf3463
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 14 deletions.
9 changes: 3 additions & 6 deletions lib/Sisimai/Lhost/qmail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ sub inquire {
}

# Detect the reason of bounce
if( $e->{'command'} eq 'MAIL' ) {
# MAIL | Connected to 192.0.2.135 but sender was rejected.
$e->{'reason'} = 'rejected';

} elsif( $e->{'command'} eq 'HELO' || $e->{'command'} eq 'EHLO' ) {
if( $e->{'command'} eq 'HELO' || $e->{'command'} eq 'EHLO' ) {
# HELO | Connected to 192.0.2.135 but my name was rejected.
$e->{'reason'} = 'blocked';

Expand Down Expand Up @@ -255,7 +251,8 @@ Sisimai::Lhost::qmail - bounce mail decoder class for qmail L<https://cr.yp.to/q
=head1 DESCRIPTION
C<Sisimai::Lhost::qmail> decodes a bounce email which created by qmail L<https://cr.yp.to/qmail.html>.
C<Sisimai::Lhost::qmail> decodes a bounce email which created by qmail L<https://cr.yp.to/qmail.html>
or qmail clones or notqmail L<https://notqmail.org/>.
Methods in the module are called from only C<Sisimai::Message>.
=head1 CLASS METHODS
Expand Down
10 changes: 5 additions & 5 deletions lib/Sisimai/Reason.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ my $ModulePath = __PACKAGE__->path;
my $GetRetried = __PACKAGE__->retry;
my $ClassOrder = [
[qw/MailboxFull MesgTooBig ExceedLimit Suspend HasMoved NoRelaying AuthFailure UserUnknown
Filtered RequirePTR NotCompliantRFC Rejected HostUnknown SpamDetected Speeding TooManyConn
Blocked/
Filtered RequirePTR NotCompliantRFC BadReputation Rejected HostUnknown SpamDetected Speeding
TooManyConn Blocked/
],
[qw/MailboxFull SpamDetected PolicyViolation VirusDetected NoRelaying AuthFailure BadReputation
SecurityError SystemError NetworkError Speeding Suspend Expired ContentError SystemFull
NotAccept MailerError/
[qw/MailboxFull AuthFailure BadReputation Speeding SpamDetected VirusDetected PolicyViolation
NoRelaying SystemError NetworkError Suspend ContentError SystemFull NotAccept Expired
SecurityError MailerError/
],
[qw/MailboxFull MesgTooBig ExceedLimit Suspend UserUnknown Filtered Rejected HostUnknown
SpamDetected Speeding TooManyConn Blocked SpamDetected AuthFailure SecurityError SystemError
Expand Down
1 change: 1 addition & 0 deletions lib/Sisimai/Reason/BadReputation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sub match {
'has been temporarily rate limited due to ip reputation',
'ip/domain reputation problems',
'likely suspicious due to the very low reputation',
'temporarily deferred due to unexpected volume or user complaints', # Yahoo Inc.
"the sending mta's poor reputation",
];
return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Expand Down
1 change: 1 addition & 0 deletions lib/Sisimai/Reason/Rejected.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ sub match {
'sender rejected',
'sender domain is empty',
'sender verify failed', # Exim callout
'sender was rejected', # qmail
'spam reporting address', # SendGrid|a message to an address has previously been marked as Spam by the recipient.
'syntax error: empty email address',
'the message has been rejected by batv defense',
Expand Down
31 changes: 31 additions & 0 deletions set-of-emails/maildir/bsd/lhost-qmail-19.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Return-Path: <>
Delivered-To: [email protected]
Received: (qmail 3019 invoked by alias); 25 Jun 2024 10:36:44 -0000
Delivered-To: [email protected]
Received: (qmail 3016 invoked for bounce); 25 Jun 2024 10:36:44 -0000
Date: 25 Jun 2024 10:36:44 -0000
From: [email protected]
To: [email protected]
Subject: failure notice

Hi. This is the qmail-send program at nq.example.jp.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<[email protected]>:
Connected to 98.136.96.74 but sender was rejected.
Remote host said: 421 4.7.0 [TSS04] Messages from 192.0.2.25 temporarily deferred due to unexpected volume or user complaints - 4.16.55.1; see https://postmaster.yahooinc.com/error-codes
I'm not going to try again; this message has been in the queue too long.

--- Below this line is a copy of the message.

Return-Path: <[email protected]>
Received: (qmail 40682 invoked by uid 0); 24 Jun 2024 06:10:02 -0000
Date: 24 Jun 2024 06:10:02 -0000
Message-ID: <[email protected]>
From: [email protected]
To: [email protected]
Subject: Nyaan?

Nyaaaaaan

2 changes: 1 addition & 1 deletion t/022-mail-maildir.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ my $Methods = {
'class' => ['new'],
'object' => ['path', 'dir', 'file', 'size', 'offset', 'handle', 'read'],
};
my $MaildirSize = 582;
my $MaildirSize = 583;
my $SampleEmail = './set-of-emails/maildir/bsd';
my $NewInstance = $Package->new($SampleEmail);

Expand Down
2 changes: 1 addition & 1 deletion t/751-lhost-opensmtpd.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ my $isexpected = {
'10' => [['5.0.912', '', 'hostunknown', 1]],
'11' => [['5.7.26', '550', 'authfailure', 0]],
'12' => [['5.0.932', '', 'notaccept', 1]],
'13' => [['4.7.0', '421', 'blocked', 0]],
'13' => [['4.7.0', '421', 'badreputation', 0]],
'14' => [['5.7.25', '550', 'requireptr', 0]],
'15' => [['5.0.947', '', 'expired', 0]],
'16' => [['5.0.947', '', 'expired', 0]],
Expand Down
1 change: 1 addition & 0 deletions t/770-lhost-qmail.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ my $isexpected = {
'17' => [['5.1.1', '550', 'userunknown', 1],
['5.2.2', '552', 'mailboxfull', 0]],
'18' => [['5.1.1', '550', 'userunknown', 1]],
'19' => [['4.7.0', '421', 'badreputation', 0]],
};

$enginetest->($enginename, $isexpected);
Expand Down
2 changes: 1 addition & 1 deletion xt/770-lhost-qmail.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ my $isexpected = {
'01011' => [['5.0.912', '550', 'hostunknown', 1]],
'01012' => [['5.0.911', '', 'userunknown', 1]],
'01013' => [['5.1.1', '', 'userunknown', 1]],
'01014' => [['5.0.918', '550', 'rejected', 0]],
'01014' => [['5.0.975', '550', 'badreputation', 0]],
'01015' => [['5.7.1', '550', 'rejected', 0]],
'01016' => [['5.1.2', '', 'hostunknown', 1]],
'01017' => [['5.1.1', '550', 'userunknown', 1]],
Expand Down

0 comments on commit edf3463

Please sign in to comment.