custom function

Valmiki N. Ramsewak lilvalo at MIKIBOY.COM
Tue Jul 13 16:20:26 IST 2004


On Mon, Jul 12, 2004 at 09:01:25AM +0100, Julian Field wrote:
> 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).

okie so i somehow got i working, well not really.. and i lost it again..

when i was kinda working it was donig this:

taking the FROM address and making it it into user-spam at domain.com

well that aint gong to work, i need it to take the to address so i changed
it the {to} and then got some horrible bouncing, and it had a memory
address in it.. so i tried dereferencing that @{$message->{to}}  and that
didn't work either, and i'm guessing thats how you dereference it? cause
thats what i saw inthe CustomConfig.pm file for the {to} field.

Anyways, I need to get off to work, but while I'm there I'm going to try
to reconstruct the sorta working script i had before (thought it modified
the from and not the to address) and post it here and see if someone can
help me :)

Thanks
Valmiki
--
Got Speed?

www.mikiboy.com
aim: lilvalo

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