On Mon, 27 Oct 2003, Phillip Hutchings wrote:

> Ah, makes sense. You would need a courierfilter on the incoming SMTP.
> Check out courierperlfilter. Basically you need to pass the message
> through to spamassassin. Check the share/perlfilter-example.pl file for
> how to implement the filter, then you want something like this in the
> perlfilter example.
>
> #Look for these lines:
> #  Here's where the custom content filter is implemented.  Use
> filehandles
> #  so that cleanup's automatic.
>
> my $fh=new IO::File "< $filename";
>
>          return "" unless defined $fh;
>
> #and insert code replacing the while loop
>
> my $filt = new Mail::SpamAssassin();
> my $status = $spamtest->check ($mail);
>       if ($status->is_spam ()) {
>               return '550 Spam Denied';
>       }
> return '';
>
> Probably some mistake there, but hopefully some list member will point
> out where.

        Found one bug.  Here's what I inserted.
------------------------------------------------------------------------
`echo hi >> /tmp/spf.log`;

my $mail = Mail::SpamAssassin::NoAudit->new({'data' => *$fh});

my $filt = new Mail::SpamAssassin();
my $status = $filt->check ($mail);
        if ($status->get_hits() > 20) {
                return '550 Spam Denied';
        }
return '';
------------------------------------------------------------------------

        Only one problem -- it never creates the /tmp/spf.log file -- I
think it's not being run.  I've run filterctl start perlfilter and
courierfilter start, and the following file is:

/etc/courier/filters/perlfilter
------------------------------------------------------------------------
/usr/local/bin/spamassassin-filter.pl
------------------------------------------------------------------------

        ...which is of course where I keep the script.  Anyway, can anyone
tell me if there's a way to get more debugging information/errors from
these scripts?  I've looked in the logs, but all I see is stuff about
starting and stopping perlfilter.

        :)

--
Tim Nelson
Systems Administrator
Sunet Internet
Tel:�+61 3 5241 1155
Fax: +61 3 5241 6187
Web: http://www.sunet.com.au/
Email: [EMAIL PROTECTED]




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to