I wrote a quick eval function that work as a proof-of-concept only. It doesn't look at the headers at all... it uses the current system time and *assumes* that the email is being scanned within a few minutes of being received by the local server. I am aware that this is a weak assumption in many (most?) cases, but this code has the advantage of being absolutely immune to forged Date: or Received: headers.

** Append to EvalTests.pm
sub received_between {
  my ($self, $min, $max) = @_;
  local ($_);
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
  my $timeString = $hour.$min;

  if ($min < $max) {
    return 1 if (($timeString > $min) && ($timeString < $max));
  }
  else {
    return 1 if (($timeString > $min) || ($timeString < $max));
  }

  return 0;
}

Append to 20_head_tests.cf
header RECVD_OUTSIDE_BUS_HOURS  eval:received_between(1900,0800)
describe RECVD_OUTSIDE_BUS_HOURS The last Received: date was outside of business hours

A business (eg) might want to give this rule a small positive value, while an ISP (eg) might want to give it a small negative value.

--Ernest

At 03:48 PM 8/4/2003 -0700, you wrote:
At 8/4/03 02:20 PM , Erick Calder wrote:
> > Instead, I'd probably write an eval function
>
>where do I find docs on how to do that?

The Camel Book? Seriously, you should learn Perl if you want to write an
eval function; it's not as simple as a one-line rule. If you do understand
Perl, then looking at a few of the other functions in
Mail::SpamAssassin::EvalTest.pm should make it clear how they work.

                                                 --Kai MacTane
----------------------------------------------------------------------
"Lucretia, my reflection, dance the ghost with me."
                                                 --Sisters of Mercy,
                                                  "Lucretia, My
                                                   Reflection"




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to