smtp,

How to remove frozen emails from the Exim mail queue

Jan 31, 2022 · 1 min read · Post a comment

Messages or emails that are sent to a non-existent email account can sit in the mail queue and maybe cause issues or stuck the relevant ones. After some period of time, usually 7 or 8 days they will be marked as frozen. So if you want to get rid of the frozen emails in the Exim mail queue, follow the steps below.

Prerequisites

  • Exim
  • sudo privileges

Check the number of all frozen emails in the queue

sudo exim -bp | grep forzen | wc -l

Remove all frozen emails from the queue

sudo exim -bp | grep 'frozen' | awk {'print $3'} | xargs exim -Mrm

Remove all emails from the queue

If you spot that all emails are spam you can remove them all with:

sudo exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash

Conclusion

If you just need to get a list from all the messages in the queue, run:

sudo exim -bp

or delete just one message:

sudo exim -Mrm {id-of-the-message}

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.