custom function
Julian Field
mailscanner at ecs.soton.ac.uk
Mon Jul 12 09:01:25 IST 2004
At 21:33 11/07/2004, you wrote:
> So then I started looking into writing a CustomFunction
>
> /opt/MailScanner/lib/MailScanner/CustomFunctions/MyExample.pm is
> the files that came with MailScanner and put my code in there.
>
> This is my code:
> sub InternalForward {
> my($fromac, $fromdomain, $todomain, $return);
> my($message) = @_;
> $fromac = lc($message->{from});
> $fromdomain = $fromac;
> $fromac =~ s/\@.*$//; # Leave everything before @
> $fromdomain =~ s/^.*\@//; # Leave everything after @
> $return = "forward ".$fromac."-spam".$fromdomain;
> MailScanner::Log::InfoLog($return);
> return $return;
> }
>
>I copied a bunch of it from some other file I was reading to figure out
>how to code it. Mailscanner starts up perfectly fine :) but then when I
>send some spam mail to the address (yes I have some saved spam mail for
>testing :) , actually a few thousand :) ) it goes to the inbox and not the
>spam folder.
You need to
1) Add a sub InitInternalForward (it doesn't need to do anything, just exist).
2) Add a sub EndInternalForward
3) Set "Spam Actions = &InternalForward" so that your code is called.
If you code is being executed, the output of InfoLog will be your syslog,
whatever program you use to provide that service (I have never used metalog).
--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
-------------------------- MailScanner list ----------------------
To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/ and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html
More information about the MailScanner
mailing list