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

I started getting spam backdated by a few years. Is there an easy way to detect and divert these to /dev/null using procmail?

share|improve this question

migrated from Feb 15 '10 at 14:37

This question came from our site for computer enthusiasts and power users.

If the date is definitely present then something simple like:

 # The order of the recipes is significant
 #  header format is "Date: Sat, 13 Feb 2010"
 * ^Date: .*,.*200[0-9]

share|improve this answer
Well, if date is not present, then the mail is not backdated, so it's correct your filter does not match in that case :-). – sleske Jul 25 '10 at 20:11

It's actually independent of procmail, but a cronjob that run at a fixed period could do this:

find /maildirectory -type f -mtime +7 -exec rm -rf {}\;

This would delete mail over a week old.

share|improve this answer
-1 The question is about deleting backdated mails (i.e. the mail arrives now, but with a date of like "2008"). Your solution would just delete mail that arrived more than 7 days ago :-(. – sleske Jul 25 '10 at 20:10

Your Answer


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