Simple steps to count emails in Exim mail queue for a specific sender/receiver

In Exim MTA(Mail Transfer Agent) there are a lot of options/commands available to manage the Email queue simply. Also, we can simply figure it out if there any spamming on that server which has Exim as MTA. We have already discussed a lot of command-line usages for Exim in my previous posts. Here I am looking for a new trick on Exim command to count total number of emails in the mail queue for a specific user(Sender or Recipient)

We can sort-it-out in different ways. Simply, by using the command “exiqgrep” and the associated switches. Also from the base command “exim -bp”.

This would be helpful to to analyse if there is any spamming from a particular account. More about spam check >> How to heck spamming on server which has Exim as MTA <<

Count emails for a user using EXIQGREP

We have discussed the usage of the command exiqgrep for deleting emails from the mail queue. Refer this for more details, Quick way to remove all emails from the mail queue and Quick way to remove all frozen emails from mail queue. Here I am listing the steps to count mail in the queue for users. We can use the switch “c” with the command exiqgrep for doing this.

Count mails for a sender.

exiqgrep -cf $user-name

c – To count.
f – For specifying sender name.


# exiqgrep -cf crybit
11 matches out of 17 messages

Count emails for a user using EXIM base command.

To count emails using the command “exim” is not much easy by comparing with the command “EXIQGREP”. Here is an example for that.

exim -bp|grep "<"|grep $user-name|wc -l


exim -bp|grep "<"|grep datesec|wc -l

Count mails for a recipient using “EXIQGREP’

Use the switch combination ‘cr’ instead of ‘cf’ with the command exiqgrep.


exiqgrep -cr $Recipient-address


exiqgrep -cr gayaxx10
11 matches out of 17 messages

Count mails for a recipient using “EXIM’ command.


exim -bp|grep $Recipient-address|wc -l


exim -bp|grep gayaxx10|wc -l

That’s it!! Hope these are helpful for you 🙂

Related links:
Check spamming on server having EXIM
Exim Log line flags
Important exim log file paths in WHM/cPanel & Directadmin

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *