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.
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 firstname.lastname@example.org, and the Recipient is email@example.com then the following would remove emails that match that criteria:
exiqgrep -f firstname.lastname@example.org -r email@example.com -i | xargs exim -Mrm
If You're certain you want to remove all email From firstname.lastname@example.org then the command would be:
exiqgrep -f email@example.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
To learn more about...
- exiqgrep, see the Exim utilities documentation.
- exim -Mrm, see the Exim command line documentation (hint, use search on page in your browser for "Mrm" to find it).
- xargs, see the manual page.