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

I use postfix, dovecot 2.1 and amavis for my emails.

How can I refuse emails (from other email servers) that date are to old (e.g. >=1 month) or to new (eg. >=1d in the future)?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Postfix has a header_check facility to allow you to scan headers and decide what to do with the email at that time.

Docs: http://www.postfix.org/header_checks.5.html

/^Date: .* (19[0-9][0-9]|200[0-9]|2010)/   REJECT Your email is stuck in a timewarp 

This is an example of a date check. Unfortunately, this is not dynamic.

Postfix does support Sendmail milters. I quickly found a date type milter here:

http://www.snertsoft.com/sendmail/milter-date/

I suspect you will likely need to use a Milter.

http://www.postfix.org/MILTER_README.html

Alternatively, I am not sure if you are using something like Spamassassin, but it too may have rules to help flag emails with bad dates.

share|improve this answer
    
milter-date is what I looked for. When I start "milter-date" the process exit with return code 0 and no output. :/ –  ChristophLSA Aug 19 '13 at 14:20

You can probably do something with header_checks, with the caveat that you'll probably have to manually update the regex to stay current, or you could write your own script to update it, ensuring that part of the script calls postfix reload or postconf <path to the file>. Spamassassin does have checks for these sort of things, but they usually happen after mail has been accepted, which is probably not ideal.

share|improve this answer

Your Answer

 
discard

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.