Hunting spambots with bad clocks

Looking back in my email history, I receive a lot of emails that are either back in the past by some significant margin (i.e. 01-01-1970… before I was even born) or way off in the future (in 2038). I just received one today which was a month old.

In almost all cases, these emails are spam. I suppose the idea is that being way back in the past, or way off in the future, it’ll appear ahead or behind all other emails. Not here however. I recently upgraded the server here, and decided to give qpsmtp a try. Being able to code plugins for SMTP is a nice feature, and there’s already a plugin that can look after this very problem. I’ve extended it, so that I’ll tolerate emails up to two weeks old, or no more than two days ahead. (I should probably make this two hours ahead, since the international date line is two hours east of me.. anyway.)

I also tweaked it so that the messages it sends back are more … well … entertaining:

552-Get with the times, 24 Aug 2010 01:08:04 -0000
552  was ages ago.
552-Get back in your tardis, 24 Aug 2011 01:08:04 -0000
552  hasn't happened yet.

In both cases there, the email was flat-rejected. No spam checking, no nothing… it took one look at the Date: header, and tossed it into the bin. The updated check_basicheaders script is here. It’d be nice if more SMTP servers rejected emails that are off in the future, or too far back in the past. I can understand a week in the past, but two weeks is getting just a little old… and until time-travel into the future becomes possible I refuse to believe I can get an email from the future legitimately (and even then, they can come back to the present and re-send it!).