Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 superuser.com Feb 15 '10 at 14:37

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

2 Answers 2

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"
 :0
 * ^Date: .*,.*200[0-9]
 /dev/null

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

 
discard

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