Re: [Exim] Running external scripts

Top Page
Delete this message
Reply to this message
Author: Bradford Carpenter
Date:  
To: exim-users
Subject: Re: [Exim] Running external scripts
On Wed, 21 Apr 2004 10:18:35 +0200, Steffen Heil wrote:

> Hi
>
> Is is possible to pass the content of a mail to ${run command ? [Preferably
> selecitve with/without headers?]
>
> Regards,
> Steffen


I'm using a construct something like this (one line - broken apart for
email) to pass the message to shell scripts:

${run{/path/to/script.sh \
${quote:${message_headers} \
${readfile{/var/spool/exim/input/${message_id}-D}}}} \
{$value}{run expansion failed}}

Then use "$1" in your script to reference the message content. The
script can then use as many commands as you need to process the message.

This should work at any point in the message processing from the system
filter on I believe (ie. after the message is accepted by the ACLs). It
uses the ${message_headers} expansion to get the headers and gets the
message body from the spool file for the message in the "input"
directory (my install paths are non-standard, so check your setup), so
you can of course drop the headers if you need to.

Have had troubles finding the correct quoting to use the script's
commands directly in exim's run expansion, but the above is working
reliably for me.

Best regards,
Brad