[Sussex] Does any one have any clues how...

Karl E. Jorgensen karl at jorgensen.com
Thu Aug 5 14:35:41 UTC 2004

On Thu, Aug 05, 2004 at 11:39:19AM +0100, Nicholas Butler wrote:
> to process a MBOX file into an SMTP server in order to redliver mail. 

procmail(1) should be usable here...

Unfortunately, the mbox file will not have any information about
the envelope; at best you will have the To: and Cc: headers to play
with.  This will make it nearly impossible to deliver the mail to the
correct person.  

> Since a Client has just discovered their MX record was yanked back to a 
> multidrop pop3 and all delivered mail was being delivered into one 
> account on the server. its all up and present so id like to reprocess 
> mbox to deliver all the message appropriately ?

If the MTA has kept the envelope, then you can extract that. Eg. exim4
seems to add a Envelope-to: header (at least for me, dunno about your
setup. I think mine is default), so something like this might work:

    formail -ds < mboxfile ./remail

where ./remail might look like:


    cat > /tmp/remail.$$

    target="`formail -zx Envelope-to` < /tmp/remail.$$"

    procmail -d "$target" < /tmp/remail.$$
    rm -f /tmp/remail.$$

DISCLAIMER: Script above is utterly untested. If it breaks you get to
keep the bits. No guarantee whatsover is offered. Some assembly
required.  Batteries not included. May contain small parts. Unsuitable
for children. This may work. May cause drowsiness.

The above assumes that you run bits on the actual mail server, since it
runs procmail in explicit delivery mode.
If the envelope-to address cannot be found then you have no way of
knowing who the mail should be delivered to...

Besides... it might all be spam anyway, where you don't have to bother!

Karl E. Jørgensen
karl at jorgensen.com   http://karl.jorgensen.com
==== Today's fortune:
While it may be true that a watched pot never boils, the one you don't
keep an eye on can make an awful mess of your stove.
		-- Edward Stevenson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20040805/0f3243a5/attachment.pgp 

More information about the Sussex mailing list