Jerry Stuckle <je...@smartechhomes.com> (Mi 07 Jun 2017 03:55:40 CEST): > Hi, all, > > 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.
"returns"? That is "writes to stdout", right? For experimenting I recomming using exim -be '${run{/path/to/command param…}{A}{B}}' Where "A" and "B" are expanded depending on the exit status of the command. The string $value may be used there and contains the merged stdout/stderr from the command. Note, that the environment is *empty* (as if you call your program `env -i program`), even $PATH isn't set there! (See keep_environment, add_environment options for ways to change this.) To ease writing you may set a MACRO: DAYS_REGISTERED = ${run{/path/to/command $sender_address_domain}{$value}} begin acl … deny condition = ${if <{DAYS_REGISTERED}{7}} ------ But, if you have it in a perl script already, you may want to use Exim's builtin Perl capabilities. (I suppose, you wrote a Perl module, having a days_registered() subroutine in @EXPORT_OK) perl_startup = use My::Module qw(days_registered); DAYS_REGISTERED = ${perl{days_registered}{$sender_address_domain}} # ACL as above The use of the MACRO is to improve the readability only. The use of the perl_startup doesn't give you any benefit here, except readability and a cleaner interface. In case you need to call more Perl scripts/functions, you get a performance gain, since the Perl interpreter gets loaded only once. As long as you do not reach the ${perl…} part of the configuration, there is no performance hit, since Exim delays loading of Perl until it's needed. > 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! Uhm… The return code? You return the number of days as return code? What if the domain is registered for >254 days? I'd send the days to stdout, using the return code only to indicate some error! Best regards from Dresden/Germany Viele Grüße aus Dresden Heiko Schlittermann -- SCHLITTERMANN.de ---------------------------- internet & unix support - Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} - gnupg encrypted messages are welcome --------------- key ID: F69376CE - ! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -
signature.asc
Description: PGP signature
-- ## List details at https://lists.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/