Sendmail ignores "-N never" option for DSN"s?
Sendmail ignores "-N never" option for DSN"s?
am 19.12.2007 11:23:09 von JonB
Hi all,
I'm trying to run down some large mail queues at the moment, that have
built up due to config changes on a few hosts, and some downtime.
I'm trying to get Sendmail to despool the queue, but *not* send *any*
DSN's - i.e. at the moment the converstation goes:
Sendmail connects to nominated MX for the destination.
MX says 'User unknown'
Sendmail connects to the nominated MX for the sender, and sends a DSN.
I don't want this second part happening for the mail in the queue.
Looking at the man page for sendmail, it says:
"
-N dsn Set delivery status notification conditions to dsn, which can
be
`never' for no notifications or a comma separated
list of the
values `failure' to be notified if delivery failed,
`delay' to
be notified if delivery is delayed, and `success' to be
notified
when the message is successfully delivered.
"
However, trying this, i.e.
"
sendmail -N never -qRsomedomain.com -v -OQueueSortOrder=filename -
OMinQueueAge=0 -OHostStatusDirectory=
"
Has no affect at all (i.e. sendmail tries the initial deliver - if
that fails, it goes off and contacts the senders MX - and tries to
send a DSN).
Is there anything else that needs to be changed to get this working? -
Is this option something like 'at submission time only?' (i.e. gets
embedded in the control QF files?)
If it is the above - is there something we can strip out, or change in
the QF's to make all the queued mail get this behaviour?
I realise the 'better solution' is not to accept the mail in the first
place - but we had no choice for a couple of hours, and I'd rather not
back-scatter the DSN's for the mail we do have in the queue.
Thanks,
J
Re: Sendmail ignores "-N never" option for DSN"s?
am 20.12.2007 00:27:56 von per
In article
<2a4da481-8bad-4eb0-8e4c-9fffd36c90a1@e67g2000hsc.googlegroups.com> JonB
writes:
>
>However, trying this, i.e.
>
>"
>sendmail -N never -qRsomedomain.com -v -OQueueSortOrder=filename -
>OMinQueueAge=0 -OHostStatusDirectory=
>"
>
>Has no affect at all (i.e. sendmail tries the initial deliver - if
>that fails, it goes off and contacts the senders MX - and tries to
>send a DSN).
>
>Is there anything else that needs to be changed to get this working? -
>Is this option something like 'at submission time only?'
Yes, i.e. it's a choice that the originator of a message can make, not
appropriate for a MTA to change.
> (i.e. gets embedded in the control QF files?)
Hm, I hadn't checked, but it would have to be as far as I can see.
>If it is the above - is there something we can strip out, or change in
>the QF's to make all the queued mail get this behaviour?
Sounds like a plan, why didn't you just try to submit a message with '-N
never' and look at the qf file?:-) But it's actually documented, from
doc/op/op.*:
R A recipient address. This will normally be completely
aliased, but is actually realiased when the job is pro-
cessed. There will be one line for each recipient.
Version 1 qf files also include a leading colon-termi-
nated list of flags, which can be `S' to return a mes-
sage on successful final delivery, `F' to return a mes-
sage on failure, `D' to return a message if the message
is delayed, `B' to indicate that the body should be
returned, `N' to suppress returning the body, and `P'
to declare this as a ``primary'' (command line or SMTP-
session) address.
I.e. a message submitted with '-N never' will lack the 'F' and 'D' flags
as compared with a "normal" one - seems it will also have the 'N' flag,
which seems a bit redundant, but doesn't hurt I guess.
--Per Hedeland
per@hedeland.org
Re: Sendmail ignores "-N never" option for DSN"s?
am 21.12.2007 05:58:16 von Joe Maimon
On Dec 19, 5:23 am, JonB wrote:
> Hi all,
>
> I'm trying to run down some large mail queues at the moment, that have
> built up due to config changes on a few hosts, and some downtime.
>
> I'm trying to get Sendmail to despool the queue, but *not* send *any*
> DSN's - i.e. at the moment the converstation goes:
>
> Sendmail connects to nominated MX for the destination.
> MX says 'User unknown'
> Sendmail connects to the nominated MX for the sender, and sends a DSN.
>
> I don't want this second part happening for the mail in the queue.
> Looking at the man page for sendmail, it says:
>
> "
> -N dsn Set delivery status notification conditions to dsn, which can
> be
> `never' for no notifications or a comma separated
> list of the
> values `failure' to be notified if delivery failed,
> `delay' to
> be notified if delivery is delayed, and `success' to be
> notified
> when the message is successfully delivered.
> "
>
> However, trying this, i.e.
>
> "
> sendmail -N never -qRsomedomain.com -v -OQueueSortOrder=filename -
> OMinQueueAge=0 -OHostStatusDirectory=
> "
>
> Has no affect at all (i.e. sendmail tries the initial deliver - if
> that fails, it goes off and contacts the senders MX - and tries to
> send a DSN).
>
> Is there anything else that needs to be changed to get this working? -
> Is this option something like 'at submission time only?' (i.e. gets
> embedded in the control QF files?)
>
> If it is the above - is there something we can strip out, or change in
> the QF's to make all the queued mail get this behaviour?
>
> I realise the 'better solution' is not to accept the mail in the first
> place - but we had no choice for a couple of hours, and I'd rather not
> back-scatter the DSN's for the mail we do have in the queue.
>
> Thanks,
>
> J
You can use patched sendmail to redirect the resulting bounces, for
example, to an alias aliased to /dev/null
http://www.jmaimon.com/sendmail/#SingleBounceAddr
Cant say I would recommend doing this without a real plan.
Re: Sendmail ignores "-N never" option for DSN"s?
am 26.12.2007 04:15:51 von lewis.bergman
On Dec 19, 4:23 am, JonB wrote:
> Hi all,
>
> I'm trying to run down some large mail queues at the moment, that have
> built up due to config changes on a few hosts, and some downtime.
>
> I'm trying to get Sendmail to despool the queue, but *not* send *any*
> DSN's - i.e. at the moment the converstation goes:
When this has happened to me I used a script using qtool.pl and find
that searches for the source of "localhost" which originates DSN's in
the queue and deletes those mails.
#!/usr/bin/perl
use strict;
# Exit immediately if domain was not specified as command-line
argument
if (!(defined($ARGV[0]))) {
(my $basename = $0) =~ s!^.*/!!;
print "Usage: $basename ip|hostname mailquedir\n";
exit 1;
}
# Convert domain supplied as command-line argument to lowercase
my $ip_to_remove = lc($ARGV[0]);
my $qtool = "/usr/local/bin/qtool.pl";
my $mqueue_directory = $ARGV[1];
my $messages_removed = 0;
use File::Find;
# Recursively find all files and directories in $mqueue_directory
find(\&wanted, $mqueue_directory);
sub wanted {
# Is this a qf* file?
if ( /^qf\w{14}/ ) {
my $QF_FILE = $_;
my $match = 0;
open (QF_FILE, $_);
while() {
# If any of the envelope recipients contain a domain other
than
# $domain_to_remove, do not match the message
if ( /^\$s$ip_to_remove/ ) {
$match = 1;
last;
}
}
close (QF_FILE);
# $QF_FILE may not contain an envelope recipient at the time it
is opened
# and read. Do not match $QF_FILE in that case.
if ($match == 1) {
print "Removing $QF_FILE...\n";
system "$qtool", "-d", $QF_FILE;
$messages_removed++;
}
}
}
print "$messages_removed total message(s) removed from mail queue.\n";
I didn't write the original code but modified it for what I wanted to
do.