Re: [Exim] Piping in EXIM...

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date: 2000-01-31 20:29 -000
To: Mark The Administrator
CC: exim-users
Subject: Re: [Exim] Piping in EXIM...
On Mon, 31 Jan 2000, Mark The Administrator wrote:

> Okay this is what i'm trying to do. I have built a 'pipe' transport in
> Exim that calls a perl script as a command. In the perl script there is
> come code that manipulates the mail file directly


Do you mean you read and re-write the -D file in Exim's spool? Highly
dangerous. What if the system crashes when the file is half-written?
(And you can't do this by writing a temporary file and renaming, because
Exim has a lock on the -D file; doing that would destroy the locking.)
(And if the message has several recipients you screw it up for the
others.)

> Running the script directly from an xterm is cool. It opens the socket &
> writes the data to either server, keeping a record of the transaction in
> an event log on the client machine.


If you just want to send messages to such a server, why don't you just
pipe them to Perl from Exim. The Perl script reads the message on its
stdin and writes it down a socket you create.

> However, calling the script from Exim seems to shut down all IO. The
> logs are not logged and the socket fails to TX to the Server. After
> reading the docs on Exim i found that Exim opens it's own socket to the
> script! Am i reading this correctly? If so is it possible to stop Exim
> 'sucking' all the IO from the script back to itself via this pipe.


Exim pipes the message to the script on its standard input, and reads
back the standard output and standard error. Just use some other Perl
file handle for writing the message where you want it to do.


-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.