[Mimedefang] mimedefang specific users

B. Tolka btolka at hsc.wvu.edu
Tue Jun 3 14:00:01 EDT 2003


First, Thanks to everyone for there time and help.

Everything is working alright except one part of the stream_by_recipient
function.  It eithers tags both messages with SPAM subject or vice
versa.

It has to be in the if statement below. If I send to one individual on
or off my list it works fine. I am very new at this. 

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;
}


Here is full function

sub stream_by_spam_list () {
    my(@on_list, @off_list, $recip);
    foreach $recip (@Recipients) {
        if (should_check_for_spam($recip)) {
            push(@on_list, $recip);
        } else {
            push(@off_list, $recip);
        }
    }

    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;
}

Thanks

Bryan Tolka

Bryan Tolka
Network Engineer
---------------------------------------
Robert C. Byrd Health Sciences Center
Morgantown, WV
304-293-4683
btolka at hsc.wvu.edu
>>> alien at 12inch.com 06/02/03 22:25 PM >>>
On 6/3/03 3:47 AM, "B. Tolka" <btolka at hsc.wvu.edu> wrote:

[...]
> 
> The function code is:
> 
> sub stream_by_receipient () {
                   ^^^  i'm hoping this is just a typo in your mail ...

>   my(@on_list, @off_list, $recip);
>   foreach $recip (@Recipients) {
>       if (should_check_for_spam($recip)) {
>           push(@off_list, $recip);
>       } else {
>           push(@on_list, $recip);
>       }
>   }
> 
>   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;
> }
> 
> 
> Any help is appreciated

If I'm reading this correctly, it looks like you could accomplish what
you
have in your code more simply by doing:

sub stream_by_recipient {

    if ($#Recipients) {
        resend_message(@Recipients);
        $TerminateAndDiscard = 1;
        return 1;
    }
    return 0;
}

since @on_list and @off_list are scoped inside of the
stream_by_recipient
subroutine, there doesn't appear to be any way for resend_message to
know if
it's sending to the on_list or the off_list.  it's just taking a list of
recipients and resending the message to them.

there also doesn't appear to be any code to control a call to
check_spamassassin  (i don't recall the exact subroutine name off the
top of
my head) based on being on_list or off_list either.

based on your snipet of code, i can only assume that
should_check_for_spam()
simply reads a list of users that have "opted in" for spam checking from
a
file or database somewhere.

so, it looks like you need to rethink your logic a little bit.  I don't
do
anything with streaming by recipient in my setup, so i don't have any
specific knowledge about how to implement what you want to do, but i'll
offer any help i can.

hope this is useful information.

alan

_______________________________________________
MIMEDefang mailing list
MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang




More information about the MIMEDefang mailing list