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)?
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)?
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.
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.