November 20, 2005

 Manipulating the Exim Queue

A few tidbits on manipulating the messages in the Exim Queue. Note the pathname to exim under @Mail is /usr/local/atmail/mailserver/bin/exim

Adding a recipient to a message:

exim -Mar message_id email@domain.dom
will add email@domain.dom as a recipient of the message and send a copy to that address.

There is no way to actually delete a recipient, but Exim can be told to pretend that delivery for a recipient has been completed. To mark one of the intended recipients as delivered:

exim -Mmd message_id email@domain.dom

Will mark the address email@domain.dom as delivered and stop delivery attempts to that address, whereas:

exim -Mmad message_id

Will mark all recipients as delivered.

These commands are handy if you need to divert a piece of mail to one or more new recipients. The safest way to do this is:

Freeze the message:

exim -Mf message_id

Use the -Mmad or -Mmd switched to mark all or individual recipients as delivered.
Use the -Mar switches to add as many new recipients as needed.
Thaw the message:

exim -Mt message_id

which will then attempt delivery on the next queue run, or force delivery now:

exim -M message_id

You can also edit the body of the message:

exim -Meb message_id

This runs vi on a copy of the spool file with a lock. No delivery attempts are made while the file is locked. There a few caveats on this and you should look up more info on it before you attempt it.

Summary of queue runner commands:

-M : Force delivery
-Mar : Add recipient
-Meb : Edit message body
-Mes : Edit sender
-Mf : Freeze message
-Mg : Give up (and bounce message)
-Mmad : Mark all recipients as delivered
-Mmd : Mark recipient as delivered
-Mrm : Remove message (no bounce)
-Mt : Thaw message
-Mvb : View message body
-Mvh : View message header
-Mvl : View message log


Filed under: Exim — Ben Duncan @ 2:35 pm

2 Comments »

  1. xargs works well for massive deletetion of queue entries.
    For instance, if you want to delete all queue entries from “spammer@atmail.com”, you can do this:
    cd /usr/local/atmail/mailserver/
    ./exiqgrep -i -f spammer@atmail.com | xargs ./exim -Mrm

    Comment by Joey — April 16, 2008 @ 12:33 pm
  2. How do you just list the mail queue

    Comment by Troy — July 25, 2010 @ 12:14 am

RSS feed for comments on this post. TrackBack URI

Leave a comment