[Mimedefang] filter & logging issues

alan premselaar alien at 12inch.com
Thu Jul 7 19:06:39 EDT 2005


B. Tolka wrote:
> Hello All,
> 
> I have a function call  should_check_for_spam that seems to be processed
> twice in my filter.  I am trying to log the System-Whitelist vs
> User-Whitelist.
> 
> I am not programmer by trade.  
> 
> What exactly does this line do in my filter? if
> (($Features{"SpamAssassin"})  && should_check_for_spam($Recipients[0])) 

this line first checks the value of $Features{"SpamAssassin"} and if 
true will then test the return value of 
should_check_for_spam($Recipients[0])      * this is the first call to 
your sub-routine.

> 
> 
> Snippets of my filter are below
> 
> sub filter_begin () {
> 
>    if(stream_by_spam_list()) {
>       return;
>    }
> 
> 
> 
> sub stream_by_spam_list () {
>     my(@on_list, @off_list, $recip);
>     foreach $recip (@Recipients) {
>         if (should_check_for_spam($recip)) {

here you make your 2nd call to your sub-routine.

(actually, 1st and 2nd are only relative to this email, chances are in 
reality that this is the first call and the check above is the 2nd call)


>             push(@on_list, $recip);
>         } else {
>             push(@off_list, $recip);
>         }
>     }

you may want to write @on_list and @off_list to a temp file for use in 
your check above and instead of calling 
should_check_for_spam($Recipients[0]) do something like 
"is_on_SA_checklist($Recipients[0])" and write a routine to check if the 
value is in the temp file.


> 
>     if ($#on_list >= 0 && $#off_list >= 0) {
>         # Some on, some off -- remail
>         resend_message(@on_list);
>         resend_message(@off_list);
>         $TerminateAndDiscard = 1;
>         return 1;
>     }
>     return 0;
> }
> 
...snip...

HTH

alan



More information about the MIMEDefang mailing list