custom function

Valmiki N. Ramsewak lilvalo at MIKIBOY.COM
Mon Jul 12 13:27:48 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).

Yea, I figured that out from looking and looking over MyExample.pm file.
This is the log file snippet. It said it delivered it, but its not
anywhere in the user's maildir. Is there someway to see the actual output
of the custom function I wrote? Like some log level thats logs every
single detail?

Anyways the last part fo the log file that should be relevant. Is
something wrong with the code that I wrote, thats in my previous email?

--- snipper from logged copied and paste as is ---


Jul 12 05:16:15 [postfix/cleanup] 0A8CFFBB0B: hold: header Received: from
latinmail.com (mx1.latinmail.com [62.37.236.140])??by jweb.co.jp (Postfix)
with ESMTP id 86285FA7FD??for <etc at mikiboy.com>; Sun, 11 Jul 2004 18:15:10
-0700 from mcn20324.urh.uiuc.edu[130.126.152.233];
from=<etc at mcn20324.urh.uiuc.edu> to=<valmiki at illininavs.org> proto=ESMTP
helo=<mcn20324.urh.uiuc.edu>
Jul 12 05:16:15 [postfix/cleanup] 0A8CFFBB0B:
message-id=<110001c467ad$f258228d$4e0056bb at latinmail.com>
Jul 12 05:16:15 [postfix/smtpd] disconnect from
mcn20324.urh.uiuc.edu[130.126.152.233]
MailScanner[13068]: [Config] calling custom init function InternalForward_
- Last output repeated twice -
MailScanner[13037]: [New Batch] Scanning 1 messages, 4409 bytes_
MailScanner[13037]: [Spam Checks] Found 1 spam messages_
MailScanner[13037]: [Virus and Content Scanning] Starting_
MailScanner[13037]: [Content Checks] Detected and will disarm HTML message in
0A8CFFBB0B_
MailScanner[13037]: [Requeue] 0A8CFFBB0B to D9A80FBB13_ Jul 12 05:16:21
[postfix/qmgr] D9A80FBB13: from=<etc at mcn20324.urh.uiuc.edu>, size=4754, nrcpt=0
(queue active)
MailScanner[13037]: [Uninfected] Delivered 1 messages_
MailScanner[13079]: [Config] calling custom init function InternalForward_

--- end snippet from log ---

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