Re: [exim] Save a mail and then execute a script

Top Page
Delete this message
Reply to this message
Author: jori.hamalainen
Date:  
To: julien.balmont, pv0001
CC: exim-users
Subject: Re: [exim] Save a mail and then execute a script
Just a though what I am doing on my setup..

Do you need to save file and run the script at 'routers' level. I believe then script would be ran several times if there is CC-field in email or in general a multiple recipients. But it depends what you need to do.

What I am doing is on "data ACL" I have a ${run} with my script. Just give variable $message_id as a parameter, then search from spool directory $message_id-H and $message_id-D files and do what ever you like. And script is ran once when message comes in.

[as a framework, not syntax checked or tested]
warn log_message = running a script to $message-id
domains|sender - preconditions
condition = ${run...
or
set acl_mscriptoutput = ${run..

- Jori

-----Original Message-----
From: exim-users-bounces@??? [mailto:exim-users-bounces@exim.org] On Behalf Of Julien Balmont
Sent: 13. toukokuuta 2008 15:40
To: Peter Velan
Cc: exim users
Subject: Re: [exim] Save a mail and then execute a script


The part with STDIN.
i hadn't found yet how to retrieve the message from EXIM. I had not thought about STDIN, this was helpful.

Thanks again

On Tue, May 13, 2008 at 2:35 PM, Peter Velan <pv0001@???> wrote:

> am 13.05.2008 14:23 schrieb Julien Balmont:
> > Peter, you're my hero :)
>
> :-[
>
> I'm curious: Which part of my message was helpfull?
>
> Peter
>
> PS: Type a response *below* the quoted material you're responding to,
> so it reads like a conversation. Please don't top-post!
> <http://www.faqs.org/faqs/comics/xbooks/readpost/section-4.html>
>
> > On Tue, May 13, 2008 at 1:20 PM, Peter Velan <pv0001@???> wrote:
> >
> >> am 13.05.2008 12:09 schrieb Julien Balmont:
> >> > BTW, I'm afraid the file is saved only after the script is called.
> >> > Is there a way to avoid this behaviour?
> >>
> >> My transport looks like ...
> >>
> >> script_transport:
> >> driver = pipe
> >> envelope_to_add
> >> delivery_date_add
> >> user = userxyz
> >> group = groupxyz
> >> command = /scriptpath/perlscript -para1=y -para2=y -para2=n - -
> >>
> >> The essential part in my script: read piped message from STDIN and
> >> save it in a file ...
> >>
> >> open( MAIL, "> $filename" );
> >> while( <> ) { print MAIL $_; }
> >> close( MAIL );
> >>
> >> Now I could do whatever I want on the stored copy of the message.
> >>
> >> Do you rely on Exim to store the message or do you read the pipe?
> >>
> >> Cheers,
> >> Peter
>
>
> --
> ## List details at http://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/
>

--
## List details at http://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/