Remove specific messages from the exim is a easy and simple way in Linux server.
IF the server is opted with cpanel than we will check this in WHM or login to SSH and do it at backend,
How do I delete unwanted email without losing legitimate mail? The queue may be large and there are various reasons why those emails are in queue. It’s best to determine that on a case by case basis.
To remove specific messages from Exim, the process usually involves identifying the message ID and then manually deleting the message. Here’s a step-by-step guide:
How to remove specific messages from the exim
It is best to be as granular as possible when removing email. If you see most of the email in the queue is from an address and also to an address, then it is best to use both the -f for From and -r for Recipient options. If the From address was sender@somedomain.com, and the Recipient is recipient@anotherdomain.com then the following would remove emails that match that criteria:
exiqgrep -f sender@somedomain.com -r recipient@anotherdomain.com -i | xargs exim -Mrm
If You’re certain you want to remove all email From sender@somedomain.com then the command would be:
exiqgrep -f sender@somedomain.com -i | xargs exim -Mrm
If there are a number of bounce back emails that show the From address as <> then the following can be used to remove those emails:
exiqgrep -f "^<>$" -i | xargs exim -Mrm
One last option if you’re certain you want to remove all frozen emails the following can be used
exiqgrep -z -i | xargs exim -Mrm
Caution
- Deleting messages from the queue is irreversible.
- Ensure you’ve reviewed the messages before deletion to avoid accidental removal of important emails.