More than one Custom Function

Paul housey at sme-ecom.co.uk
Thu May 14 18:28:07 IST 2009


Julian Field wrote:
>>> On 13/05/2009 12:32, Paul Houselander wrote:
>>>       
>>>> Hi
>>>>
>>>> I have a mailscanner set up that uses the Always Looked Up Last
>>>> directive to call a custom function I wrote that logs to a postgres
>>>> database. 
>>>>
>>>> I want to try to get it to now to ALSO log to a mysql database using
>>>> mailwatch. 
>>>>
>>>> Is it possible to run 2 CustomFunctions from the same directive?
>>>>
>>>>         
>>> Why not just write a Custom Function that calls both bits of code?
>>> Just pass all the parameters to both functions, simple as that.
>>>
>>> Jules
>>>
>>>       
>> Hi Jules
>>
>> I did think about doing that, it was just I recalled someone writing a
>> wrapper that allowed you to call 2 custom functions? I may well have
>> drembt it as cant find anything via the wiki or searching through the
>> archives!
>>     
>
> I do this with a function called wrapper (not real unique)
>
> In MailScanner.conf
>
> # If you want to use it, read CustomConfig.pm.
> Always Looked Up Last = &Wrapper
>
>
> In CustomConfig.pm
>
> sub InitWrapper {
>  InitExtendedLogger();
>  InitMailWatchLogging();
> }
>
> sub Wrapper {
>  my($msg) = @_;
>  ExtendedLogger($msg);
>  MailWatchLogging($msg);
> }
>
> sub EndWrapper {
>  EndExtendedLogger();
>  EndMailWatchLogging();
> }
>
> The sub Wrapper calls the functions, the InitWrapper calls the other Init
> functions and EndWrapper calls the other End functions
>
> Rick
>   
Thanks Rick thats works like a treat - logging to both mysql and postgres!

I just realised another issue I have, the postgres set up has to use

Quarantine Whole Messages As Queue Files = yes

as when it releases a message it just copies the qf and df file to the 
mqueue.

Mailwatch requires

Quarantine Whole Messages As Queue Files = no

without changing to much code does anyone know how I can run with both? 
i.e. quarantine files as both qf df and also as one file?

Cheers

Paul



More information about the MailScanner mailing list