Flush the exim mail queue

Posted in Email Servers -

I have the exim mail server running on one of my customer's webservers. Their internal mail server hadn't been accepting mail overnight so they hadn't got a whole bunch of important emails from the webserver and I needed to flush the exim mail queue. A quick read of the exim man page answered my question about how to do this and I thought I'd write a quick post to show how to flush the exim mail queue.

Command to flush the exim queue

There are two ways to flush the exim mail queue:



exim -q

This will then process the mail queue. I had a look at the exim log file and the mail queue itself (I'll be posting how to view what's in the exim mail queue on Tuesday) after flushing the queue and the emails were still stuck there.

Additional flags to force mail send

Another quick look at the exim man page and I discovered the following options:

 -qf = If one f flag is present, a delivery attempt is forced for each non-frozen message, whereas without f only those non-frozen addresses that have passed their retry times are tried.

-qff = If ff is present, a delivery attempt is forced for every message, whether frozen or not.

So I then ran this:

exim -qff

And the messages that were stuck in the queue were flushed and delivered. My customer reported back to me a few minutes later that their emails had been received.

Path to exim command

Note that the exim command is probably in /usr/sbin and you may need to use the whole path as well as the command to run it. If this is the case then do this:

/usr/sbin/exim -q
/usr/sbin/exim -qff

As mentioned above, the next post will show how to view what's currently in the exim mail queue.

Related posts: