How to manage Exim mail queue

Site Admin
Posts: 50
Joined: Thu May 30, 2013 10:28 pm

How to manage Exim mail queue

Postby hrdedicated » Sat Jun 01, 2013 12:13 pm

Exim Commands


Here are some useful things to know for managing an Exim server.
Message-IDs and spool files. The message-IDs that Exim uses to refer to messages in its queue are mixed-case alpha-numeric, and take the form of: XXXXXX-YYYYYY-ZZ. Most commands related to managing the queue and logging use these message-ids.
There are three -- count 'em, THREE -- files for each message in the spool directory. If you're dealing with these files by hand, instead of using he appropriate exim commands as detailed below, make sure you get them all, and don't leave Exim with remnants of messages in the queue.

Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.

Files in /var/spool/exim/input are named after the message-id, plus a suffix denoting whether it is the envelope header (-H) or message data (-D).

These directories may contain further hashed subdirectories to deal with larger mail queues, so don't expect everything to always appear directly on the top /var/spool/exim/input or /var/spool/exim/msglog directories; any searches or greps will need to be recursive. See if there is a proper way to do what you're doing before working directly on the spool files


To run following commands you must be login as root on the server.

1. # exim –bpc

Print a count of the messages in the queue:

2. # exim –bp

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

3. # exim -bp | exiqsumm.

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

4. # eximstats /path/to/exim_mainlog

Generate and display Exim stats from a logfile:

5. #eximstats -ne -nr -nt /path/to/exim_mainlog

Generate and display Exim stats from a logfile, with less verbose output:

6. # fgrep 2007-02-16 /path/to/exim_mainlog | eximstats

Generate and display Exim stats from a logfile, for one particular day:

7. # exiwhat

Print what Exim is doing right now:

8. #exim -bp | awk '$6~"frozen" { print $3 }' | xargs exim –Mrm

To delete frozen emails

9. #exim -qff -v -C /etc/exim.conf &

To deliver emails forcefully

Searching the queue:

Exim includes a utility that is quite nice for grepping through the queue, called exiqgrep. Learn it. Know it. Live it. If you're not using this, and if you're not familiar with the various flags it uses, you're probably doing things the hard way, like piping `exim -bp` into awk, grep, cut, or `wc -l`.

1. # exiqgrep -f [luser]@domain

Search the queue for messages from a specific sender:

2. # exiqgrep -r [luser]@domain

Search the queue for messages for a specific recipient/domain:

3. # exiqgrep -i [ -r | -f ] ...

Print just the message-id as a result of one of the above two searches:

4. # exiqgrep -c [ -r | -f ] ...

Print a count of messages matching one of the above searches:

5. # exiqgrep –i

Print just the message-id of the entire queue:

6. # exim -q –v

Managing the queue, Start a queue run:

7. #exim -ql –v

Start a queue run for just local deliveries:

8. #exim -Mrm [ ... ]

Remove a message from the queue:

9. # exim -Mf [ ... ]

Freeze a message:

10 # exim -Mt [ ... ]

Thaw a message:.

11# exim -M [ ... ]

Deliver a specific message:

12. # exim -Mg [ ... ]

Force a message to fail and bounce:

13. # exiqgrep -z -i | xargs exim –Mrm

Remove all frozen messages:

14. # exiqgrep -o 1296000 -i | xargs exim –Mrm

Remove all messages older than five days (86400 * 5 = 432000 seconds):

15 # exiqgrep -i -f user@example.tld | xargs exim –Mf

Freeze all queued mail from a given sender:

16. # exim –Mvh

View a message's headers:

17. # exim –Mvb

View a message's body:

18. # exim –Mvl

View a message's logs:

Return to “Hostripples dedicated Servers (Linux/Windows)”

Who is online

Users browsing this forum: No registered users and 1 guest