Re: [exim] Calling a PERL script

Góra strony
Delete this message
Reply to this message
Autor: Klaus Ethgen
Data:  
Dla: exim-users
Temat: Re: [exim] Calling a PERL script
Hi Jerry,

Am Mi den 7. Jun 2017 um 2:55 schrieb Jerry Stuckle:
> I'm kinda lost here. I have a perl script (call it xyz.pl) I need to
> call from ACL processing (SPAM handling). The script returns the number
> of days since the sending domain was registered or -1 if it can't be
> determined.
>
> What I want is to call the script during ACL processing, and if the
> domain has been registered less than 7 days (0 <= return value < 7), the
> email is rejected.
>
> I have the script working, but having trouble figuring out how to call
> it from Exim and handle the return code. And the more I go through the
> docs, the more confused I get - Exim is just too powerful!


The trick is that you don't implement a full script than just a
function. in that function you can return whatever you want.

It is more like a package than a standallone script. (But without
package directive.)

Then you use the following in your main config:
perl_startup = do '/etc/exim4/exim.pl'

That is starting /etc/exim4/exim.pl in the embedded perl interpreter.
Pretty fast, to say. I had that in a big deployment with many million
mails per day.

After that you can use it in your ACL for example:
contition = ${perl{my_pretty_function}{$whatever_I_want_to_say_to_the_function_as_argument}}
or
contition = ${perl{my_pretty_function}{$whatever_I_want_to_say_to_the_function_as_argument1}{$whatever_I_want_to_say_to_the_function_as_argument2}}

In the perl file you can do whatever you want. Use modules, do some
callouts, whatever.

Regards
   Klaus
- -- 
Klaus Ethgen                                       http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@???>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C