Sendmail Queue Groups.

Jim Barber jim.barber at
Tue Nov 4 02:27:20 GMT 2008

Hi all.

I've successfully been using MailScanner with Exim.
Now I am setting up a box that uses Sendmail.

The Sendmail configuration uses queue groups.
The relevant entries from the file for this are:

    define(`QUEUE_DIR', `/var/spool/mqueue/main*')dnl
    QUEUE_GROUP(`mqueue', `Path=/var/spool/mqueue/incoming, Runners=0')dnl
    QUEUE_GROUP(`main', `Path=/var/spool/mqueue/main, Flags=f')dnl
    QUEUE_GROUP(`hourly', `Path=/var/spool/mqueue/hourly, Flags=f, 

Note the asterisk on the end of the QUEUE_DIR name.
It specifies that the /var/spool/mqueue/ directory will be the base 
directory for all the queue groups.
Without the asterisk, Sendmail will expect all queue groups to be under 
/var/spool/mqueue/main/ instead.

The default mqueue queue group has been overridden to place emails into 
an incoming directory.
It has no queue runners to try to pick up messages from this queue and 
deliver them.
MailScanner is configured to do the processing of the incoming queue.

The main queue group is where MailScanner will place good messages.
Sendmail is configured with queue runners to check this queue every minute.

The hourly queue is for jobs that will only attempt to be delivered 
every hour.
A cronjob will move jobs into the hourly queue that have been 
sitting in the main queue for too long.

The MTA part of Sendmail is invoked with the following command line options:

    -OPrivacyOptions=noetrn -ODeliveryMode=queueonly

The DeliveryMode=queueonly will force the MTA not to attempt an 
immediate delivery of an incoming message.
Queue runners are started for the main and hourly queues.

The relevant MailScanner.conf configuration entries are:

    Incoming Queue Dir = /var/spool/mqueue/incoming
    Outgoing Queue Dir = /var/spool/mqueue/main
    MTA = sendmail

The Sendmail2 variable has been commented out completely.

When MailScanner has processed a message it moves it to the 
/var/spool/mqueue/main/ directory.
Then it calls the KickMessage subroutine in the perl module.
This has the following line of code:

    $args = " -OQueueDirectory=$queue " if $queue;

I think KickMessage calls sendmail to attempt an immediately delivery 
after placing a job on the queue.
This is so that the message doesn't have to wait for a queue runner to 
process it.
As part of that it needs to tell Sendmail where the message is located.

The problem with the configuration above is that it causes the following 
errors to be output by Sendmail:

    sendmail[2493]: NOQUEUE: SYSERR(root): QueuePath 
/var/spool/mqueue/incoming not subpath of QueueDirectory 
    sendmail[2493]: NOQUEUE: SYSERR(root): QueuePath 
/var/spool/mqueue/hourly not subpath of QueueDirectory 
/var/spool/mqueue/main/: No such file or directory

And the immediately delivery attempt doesn't happen.
But the mail does get picked up by the queue runners up to a minute 
later so it isn't the end of the world.

If I change the following in MailScanner.conf:
    Outgoing Queue Dir = /var/spool/mqueue/main
    Outgoing Queue Dir = /var/spool/mqueue/main*
Then I suspect Sendmail will be happy.
But MailScanner isn't happy with that.
If I try it, I'll see messages like the following when I start MailScanner:

    Could not read directory /var/spool/mqueue/main* at 
/usr/share/MailScanner//MailScanner/ line 2488
    Error in configuration file line 159, directory 
/var/spool/mqueue/main* for outqueuedir does not exist (or is not 
readable) at /usr/share/MailScanner//MailScanner/ line 2812

If I comment out the code in the file, then I get rid of the 
But I'm not sure if the immediate delivery attempt happens if I do that.
I could also butcher the code to say:

    $args = " -OQueueDirectory=/var/spool/mqueue/main* ";

But that's pretty evil.

Is there a good way to get MailScanner to play nicely with queue groups 
set up like this?
Perhaps this could be a feature request to allow the * in the Outgoing 
Queue Dir setting and handle it accordingly?


Jim Barber
DDI Health

More information about the MailScanner mailing list