Emails can build up for a variety of different reasons but mainly results from emails which were undelivered. 

When an email is sent and undelivered, the Mail Transfer Agent will typically try to deliver it several more times. If still the email remains undelivered after a predefined amount of days in Exim conf (timeout_frozen_after), those emails will be marked as frozen.

# grep timeout_frozen_after /etc/exim.conf
timeout_frozen_after = 5d

There are many exim mail server command line options to help manage an email queue, here we'll focus on clearing frozen email.

To remove all frozen emails from the mail queue

# exim -bp|grep frozen|awk '{print $3}' |xargs exim -Mrm
# exiqgrep -z -i | xargs exim -Mrm
# exim -bp | grep "<>" | awk {'print $3'} | xargs exim -Mrm

To remove emails which are in the queue for more than 5 days (432000 seconds)

# exiqgrep -o 432000 -i | xargs exim -Mrm

# exim -bp | grep "" | awk {'print $3'} | xargs exim -Mrm
# exiqgrep -o 0 -i | xargs exim -Mrm

Did this answer your question?