[Exim] Perl usage in Exim

Top Page
Delete this message
Reply to this message
Author: Kyle Monarch
Date:  
To: exim-users
Subject: [Exim] Perl usage in Exim
[ Converted text/html to text/plain ]

I am running Exim 4.24.

This is what I am trying to accomplish:

1. Use a filter to parse an incoming message based on the SUBJECT and SENDER.

2. Based on the SUBJECT, pass the message SUBJECT and BODY to a Perl
subroutine (I verified that the Perl interpreter functions - see below)

3. Use the return value of the Perl subroutine in the BODY of a reply message
to be launched to the SENDER.

I am failing at step (2) - I am unable to pass parameters to the Perl
subroutine, Exim is trying to expand the string I want passed to Perl.

This is the error message I get:

> LOG: MAIN


== monarch@trpdweb R=userforward defer (-17): error in filter file: failed to
expand "${perl{perl_subroutine}{$header_subject}}" in mail command: missing }
at end of string - could be header name not terminated by colon

Without success I tried double quotes, single quotes, escaped quotes, et
cetera.

(This worked in filter test mode though...)

I was unable to find any documentation on string expansion issues pertaining
to passing parameters in the aforementioned context.

Here are my questions:

a - What is the proper syntax for step (2) above? Should I be obtaining
parameters from within the Perl subroutine instead?

b - Can I have a Perl subroutine (array or a hash) return multiple variables
to the filter?

c - Can I access all filter commands from within a Perl subroutine (i.e: could
I execute step (3) from within the subroutine?)

d - Can you recommend a good source of information on using Perl with Exim?

Proof that the built-in Perl interpreter works:

#Perl subroutine

sub hello {

return 1;

}

# Exim filter

if ${perl{hello}} is "1"

then deliver monarch@trpdweb

endif

#Results:

LOG: MAIN

<= monarch@trpdweb U=monarch P=local S=405

[monarch@trpdweb monarch]$ LOG: MAIN

=> monarch <monarch@trpdweb> R=localuser T=local_delivery

LOG: MAIN

Completed



------------------------------------------------------------------------------
Is your computer infected with a virus? Find out with a FREE computer virus
scan from McAfee. Take the FreeScan now![1]

===References:===
1. http://g.msn.com/8HMBENUS/2755??PS=