Command to show number of emails in exim queue.
Command: exim -bpc user@server.com [~]# exim -bpc 2
Command to show all emails in the queue:
Command: exim -bp
user@server.com [~]# exim -bp
14h 906 1drVos-0001JR-W9 <sender@server1.com>
receiver@server2.com
receiver@server1.com
10h 31K 1drZWv-0003dp-8q <>receiver@server2.com
receiver@server2.com
exim -bp shows all emails in the queue with age, mail size, pool file id, from & to addresses.Command to find Exim Queue Summary:
Command: exim -bp | exiqsumm
user@server1 [~]# exim -bp | exiqsumm
Count Volume Oldest Newest Domain
----- ------ ------ ------ ------
2 1812 14h 14h gmail.com
1 31KB 11h 11h user@server2.in
---------------------------------------------------------------
3 33KB 14h 11h TOTAL
This command provides summary of whole email queue of the server including, email count, email size, age & domain with emails per domain name. Command to read email header using Exim via shell:
exim -Mvh exim-id(replace exim-id with the original exim id of the queue from command exim -bp)
Command to read email body using Exim via shell:
exim -Mvb exim-id(replace exim-id with the original exim id of the queue from command exim -bp)
Note: -Mvb - message view body -Mvh - message view header.
Command to remove an email using Exim via shell:
exim -Mrm exim-id(replace exim-id with the original exim id of the queue from command exim -bp)
Note: -Mrm -message remove.
Remove multiple emails from queue:
First we need to look at a pattern/regex to remove emails or domain name, then we append other shell commands to remove emails. Example: Remove all emails from user dd@spammerdomain.com, the command would be:
exim -bp | grep "dd@spammerdomain.com" | awk '{print $3}' | xargs -i exim -Mrm {}
The above command will grep all emails in the queue of user dd@spammer.com then awks row three which is message id & then sends to removal. Please do use this command carefully & *Do Not* copy paste.
Remove all emails from exim email queue:
We use exiqgrep command to handle most of email queue related tasks rather that exim direct command. To remove emails, we run:
exiqgrep -i | xargs -i exim -Mrm {}
This will grep all ids of exim email queues & append to removal. exiqgrep command & usage: exiqgrep is a program & an Exim message queue display utility tool used to manage your email queues via shell interface. You can collect any details of exim queue using this powerful tool & the usage is as below: Exim message queue display utility.
Usage: exiqgrep -option input
exiqgrep -
-C Specify which exim.conf to use.
Selection criteria:
-f Match sender address sender (field is "< >" wrapped)
-r Match recipient address
-s Match against the size field from long output
-y Message younger than
-o Message older than
-z Frozen messages only (exclude non-frozen)
-x Non-frozen messages only (exclude frozen)
[ NB: for regexps, provided string sits in // ]
Display options:
-c Display match count
-l Long Format [Default]
-i Message IDs only
-b Brief Format
-R Reverse order
-a All recipients (including delivered)