RE: [Exim] SMTP Push

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Andrew Chant
Υ/ο: exim-users
Αντικείμενο: RE: [Exim] SMTP Push
On Tue, 15 May 2001, Andrew Chant wrote:

> The only unknown part of it from what I see is how I would get the mail from
> the maildir into exim. I can see how it would then send on. What would you
> sugest?


A maildir file is just a message. If you aren't accessing these messages
in any way, you should first configure Exim to deliver them into the
maildir files in BSMTP format. That stores, for each message, the
envelope in SMTP commands at the top of the file. Then, all you need to
do to pass the message back is

exim -bS </the/file

as long as you run Exim as a trusted user (so that the envelope sender
in the message is believed). The script I referred to would be something
to scan the maildir directory, find all the file names, and run the
above command for all of them. Or, more efficiently, run a single exim
command and write all the files to it, one after the other. Hmm. Maybe
you don't even need a script. Perhaps

cat * > exim -bs

would do the job, but of course you'd need some means of removing the
files afterwards, and ensuring you didn't remove the files that had
arrived after the "cat", so I suspect a little Perl script is probably
best: "find file names; write to Exim; if no errors, remove files".
Hmm again (I'm thinking as I type here), maybe we can make it even
simpler:

cd /the/maildir/directory
mkdir sendtmp
mv new/* sendtmp
cat sendtmp/* > exim -bS
rm -rf sendtmp

though you should probably test the return from exim and take some
action if it is not zero (such as moving the messages into some other
directory and mailing the postmaster with the stderr/stdout from exim).


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