On Wed, 16 May 2001, Nigel Metheringham wrote:
> > This all sounds so easy, but there is a slight flaw in the plan. The
> > messages will need to be accessed by other software, so they will need
> > to be stored in the maildir format.
You (not you, Nigel, I mean Andrew) mean "non-BSMTP" format, that is,
without SMTP commands, just as pure 822 messages. You can't really call
that "maildir format".
> In that case make sure that exim is writing the Return-Path: and
> Envelope-To: headers, then write a small perl script which:-
>
> - connects to the SMTP or BSMTP server - ie open "|/usr/sbin/exim -bS"
> - opens the maildir file
> - reads the first couple of lines (ie envelope-to & return-path)
> - writes "MAIL FROM <contents of return-path>"
> - writes "RCPT TO <contents of envelope-to>"
It's a bad day for typos (I posted > instead of | for a pipe earlier
today). That should read
- writes "MAIL FROM:<contents of return-path>"
- writes "RCPT TO:<contents of envelope-to>"
The colons are vital. Strictly there shouldn't be any space between :
and < but most MTAs don't mind. (Note that < and > are characters that
should actually appear in the line; they are not metacharacters
surrounding a data description.)
> - writes "DATA"
> - shoves message data down pipe
... and then writes "."
> - finishes up
>
> You probably want a couple of wrinkles - most of that should be in a
> per file loop, and you want to check for lines starting with "." and
> double them.
and you should check the return code from exim. See documentation on
BSMTP for how Exim handles errors in -bS mode.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.