How To: Manage Exim Mail Queue

  Email

Below are the most useful commands:

Print a count of the messages in the queue:

[cc]root@localhost# exim -bpc[/cc]
Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

[cc]root@localhost# exim -bp[/cc]
Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

[cc]root@localhost# exim -bp | exiqsumm[/cc]

Print what Exim is doing right now:
[cc]root@localhost# exiwhat[/cc]

Use -f to search the queue for messages from a specific sender:

[cc]root@localhost# exiqgrep -f mail@domain[/cc]

Use -r to search the queue for messages for a specific recipient/domain:

[cc]root@localhost# exiqgrep -r user@domain[/cc]

Use -o to print messages older than the specified number of seconds. For example, messages older than 1 day:

[cc]root@localhost# exiqgrep -o 86400[/cc]

Use -y to print messages that are younger than the specified number of seconds. For example, messages less than an hour old:

[cc]root@localhost# exiqgrep -y 3600[/cc]

Use -z to match only frozen messages, or -x to match only unfrozen messages.

[cc] exiqgrep -z [/cc] or [cc]exiqgrep -x[/cc]

Use -i to print just the message-id as a result of one of the above two searches:

[cc]root@localhost# exiqgrep -i -z[/cc] or [cc]root@localhost# exiqgrep -i -x[/cc]

Use -c to print a count of messages matching one of the above searches. For example, count the number of frozen messages:

[cc]root@localhost# exiqgrep -c -x[/cc]

Managing the queue

Start a queue run:
[cc]
root@localhost# exim -q -v[/cc]
Start a queue run for just local deliveries:

[cc]root@localhost# exim -ql -v[/cc]
Remove a message from the queue:

[cc]root@localhost# exim -Mrm [/cc]
Freeze a message:

[cc]root@localhost# exim -Mf [/cc]
Thaw a message:

[cc]root@localhost# exim -Mt [/cc]
Deliver a message, whether it’s frozen or not, whether the retry time has been reached or not:

[cc]root@localhost# exim -M [/cc]

Force a message to fail and bounce as “cancelled by administrator”:

[cc]root@localhost# exim -Mg [/cc]
Remove all frozen messages:
[cc]
root@localhost# exiqgrep -z -i | xargs exim -Mrm[/cc]
Remove all messages older than five days (86400 * 5 = 432000 seconds):

[cc]root@localhost# exiqgrep -o 432000 -i | xargs exim -Mrm[/cc]
Freeze all queued mail from a given sender:

[cc]root@localhost# exiqgrep -i -f luser@example.tld | xargs exim -Mf[/cc]
View a message’s headers:

[cc]root@localhost# exim -Mvh [/cc]
View a message’s body:

[cc]root@localhost# exim -Mvb [/cc]
View a message’s logs:
[cc]root@localhost# exim -Mvl [/cc]