preload preload preload preload

Queue Management

Queue Management

Understanding the mail queues, what they do and how they work are important steps to Postfix configuration.  Here are the queues listed with a summary of what they do and where they are located.

Incoming
The incoming queue is the location a message is sent once it has entered the system through SMTP or qmqpd  and then was sent to the cleanup service.  The cleanup service will provide the last evaluation of email before it is queued.  The cleanup service can fix missing headers and do some content evaluation with regular expressions.  The queue file is  changed to the Postfix user with permissions of 0600 until the cleanup service is ready to move the file to the incoming queue then the permissions are changed to 0700.  When the queue manager reviews the incoming queue to send messages to the active queue it will also evaluate the resource limits for the active queue to verify that they have not been exceeded.

Active
The  active queue has a default resource limit of 20,000 messages which when it is exceeded the queue manager will stop scanning the incoming and deferred queues.  The messages in the active queue are ready to be delivered.  The active queue is different than the other queues as it is stored in memory and not on disk.    This is why it is important to have a limit as it is necessary to guard the available memory on the system.

Maildrop
The maildrop queue will hold messages sent by the sendmail command.  The pickup service will scan and send mail in the maildrop on a regular basis.

Deferred
If Postfix cannot deliver a message to a recipient it is placed in the deferred queue.  The queue manager will scan the deferred queue to see it if can place mail back into the active queue.  How often this scan occurs is determined by the queue_run_delay.

If you have a very busy mail server you may see a large deferred queue.  The first instinct is to flush the queue but that actually may be counter productive.  The only reason you would flush the deferred queue is if you think that the messages now have a good chance of delivery.  If they still do not have a good chance of delivery it will only slow down an already busy server.

Hold
The SMTP policies that you set as well as the header and body checks can force mail to be placed in the hold queue.  Any messages that arrive here will remain here until an administer acts upon the message.  An administrator can run the postsuper -r command to send mail in the hold queue to the maildrop queue.  Mail will remain here until the maximal_queue_lifetime parameter is exceeded, at that point it is bounced back to the sender.

Corrupt
The queue files that are damaged are placed in the corrupt directory.  Any corrupt files can be viewed by an administrator with the postcat command.

Each queue has a directory found in /var/spool/postfix as seen below.
/var/spool/postfix/incoming
/var/spool/postfix/active
/var/spool/postfix/bounce
/var/spool/postfix/corrupt
/var/spool/postfix/deferred
/var/spool/postfix/hold