Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My postfix was badly configured and let a lot of spam emails through to an account. I've fixed postfix now so it's become a much better spam filter, and almost no new spam is getting through. However, there are still a lot of old spam emails on the server which I would like to remove somehow. These are Maildir style email files (ie one file per email). Is there a command line tool for going through these emails that have already passed the mail server? I don't want them to reach the client.

Basically, all I need is a cli to check whether one email file is a spam or not, then I can sort out the rest using the "find" command.

I've found rblcheck but it seems to require an ip address (rather than a whole email) as input.

Any ideas?

share|improve this question
up vote 0 down vote accepted

you can try running spamassassin on every single message and then analyzing its output.

some example here.

share|improve this answer
Thanks but unfortunately not many of these emails get a high enough score. Many of them <1. I think it's a matter of matching domains and/or ips against blacklists. – Verity Jun 14 '12 at 9:46

You can put something like spam gateway before your mail server. But this gateway should not only inspect smtp because it will do nothing with spam email in maildirs but also have to inspect pop and imap. I know that Untangle can work as transparent bridge and check all smtp, imap and pop protocols for spam

Its not exacly the same thing that you asked but it will prevent spam emails from reaching your clients.

share|improve this answer
Yes I've thought of changing the architecture a bit, but it will not help this problem now. I didn't know about untangle. – Verity Jun 14 '12 at 9:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.