> -----Original Message-----
> From: Martin Gregorie [mailto:[EMAIL PROTECTED]
> Sent: Sunday, June 15, 2008 2:45 PM
> To: ML spamassassin
> Subject: Re: rule based on time
> 
> 
> On Sun, 2008-06-15 at 11:41, Leonardo Rodrigues Magalhães wrote:
> >     Hello Guys,
> >
> >     Is it possible to write a rule that matches based on the current
> > time of the host running spamassassin ?? I would like to simply add,
> > let's say, 1 point for EVERY message received during night, for
> example,
> > 9PM until 6AM.
> >
> >     is that possible to write that rule ?
> 
> Something like:
> 
> header Received =~ /hostname.* (2[1-3],0[0-8]):/

I guess it should be something like:

        header NIGTHMARE Received =~ m'by 
your\.internal\.host\s.*\s(?:2[1-3]|0[0-6])(?::[0-9][0-9]){2}'

Please note I didn't test it.

This, of course,  if your internal relays put the localtime in their received 
lines, otherwise you have to adjust for localtime to UTC. And occasionally for 
the daylight-saving offset.

One could use the X-Spam-Relays-Internal keyword instead of the Received one, 
but it doesn't seem to report any date and time. What about 
X-Spam-Relays-Internal:raw?

Giampaolo



> 
> may do it. "hostname" is the name of the final MTA host in the received
> chain and " (2[1-3],0[0-8]):" is intended to match the hour when it was
> received, but is probably wrong.
> 
> IOW, match the hour in the last Received: header in the mail delivery
> chain. If you're running Postfix this Received: header would be matched
> by "Received =~ by" while the rest would match "Received =~ from" but I
> don't know if that would work with other MTAs.
> 
> 
> Martin Gregorie
> 
> 


Reply via email to