Sendmail Howto
Jump to navigation
Jump to search
To delete the sendmail deferred mail queue use the following script from here:
#!/usr/bin/perl use strict; my $qtool = "/home/src/sendmail-8.13.6/contrib/qtool.pl"; my $mqueue_directory = "/var/spool/mqueue/q4"; 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 $queue_id = $1; my $deferred = 0; my $from_postmaster = 0; my $delivery_failure = 0; my $double_bounce = 0; open (QF_FILE, $_); while(<QF_FILE>) { $deferred = 1 if ( /^MDeferred/ ); $from_postmaster = 1 if ( /^S<>$/ ); $delivery_failure = 1 if \ ( /^H\?\?Subject: DELIVERY FAILURE: (User|Recipient)/ ); if ( $deferred ) { $double_bounce = 1; last; } } close (QF_FILE); if ($double_bounce) { print "Removing $queue_id...\n"; system "$qtool", "-d", $qf_file; $messages_removed++; } } } print "\n$messages_removed total \"double bounce\" message(s) removed from "; print "mail queue.\n";
doing
sendmail -q
forces sendmail to run the queue
Also when restarting sendmail on the RaQ make sure that there is a thread open for [accepting connections] otherwise it won't do any inbound mailing.