Mail - Flushing Queue Periodically


2003-08-11
On some systems sendmail is not set to automatically flush the queue. This can result in emails remaining in the queue if the recipient’s host is down… forever they will wait patiently to be delivered. But alas their hope is in vain for the Queue Runner daemon is sleeping. They wait for eternity.

To see a listing of the sendmail queue:

# sendmail -bp

If you see this then all is well:

/var/spool/mqueue is empty
Total requests: 0

But if you see a list of undelivered email and total requests in the hundreds you have a problem.

Kill sendmail.

# killall sendmail

Start sendmail with option to flush queue every 30 minutes.

# sendmail -q30m -bd

Don’t forget to update your startup scripts. Some emails may remain in the queue if the host is still down.