[antispam-f] Re: More BASIC User Rules

  • From: Stuart Painting <stuart@xxxxxxxxxxxxxxxxxx>
  • To: antispam@xxxxxxxxxxxxx
  • Date: Fri, 29 Feb 2008 22:41:02 GMT

Harriet Bazley <lists@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> In order to compare two different fields against each other you have to
> use the FNUserTest_EndOfHeader feature.

Not _strictly_ necessary. I have a usertest called "@from_to" which 
compares the contents of the "From:" field with the contents of the 
"To:" field and it doesn't use the EndOfHeader feature.

In the Rules file I have the line:

delete * @ from_to

and in UserTests I have:

DEF FN@from_to
LOCAL user_return%, n$, i%, len%
user_return% = FALSE
IF k$ = "from" OR k$ = "to" THEN
  len% = LEN(d$)
  IF len% > 5 THEN
    n$ = d$
    i% = INSTR(n$, "@"): IF i% > 0 THEN n$ = LEFT$(n$, i%-1)
    i% = INSTR(n$, "<"): IF i% > 0 THEN n$ = LEFT$(n$, i%-1)
    IF LEN(n$) > 4 THEN
      IF k$ = "from" THEN
        user_from$ = n$
      ELSE
        user_to$ = n$
      ENDIF
      IF user_to$ = user_from$ THEN user_return% = TRUE
    ENDIF
  ENDIF
ENDIF
=user_return%

Of course I have to fiddle around resetting variables at the beginning 
of each message, but at least it does get triggered at the "right" 
header line.




-- 
-

Other related posts: