OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Re-injecting a mailbox into postfix?

From: mouss (mlist.onlyfree.fr)
Date: Mon Sep 03 2007 - 15:17:32 CDT


Sean Tempesta wrote:
> Luciano: I tried using this on a test message and it appears to work
> (minus a loopback problem).
>
> Magnus: Is there a way to strip out any non mydestination recipients
> so Postfix doesn't deliver mail to other recipients in the header?

sendmail -t will use the From and To/Cc headers. These headers are not
the envelope sender and recipient.

for each message,
- set the sender to the Return-Path address
- set the recipient to the delivered-To address
- remove or rewrite the Delivered-To header to avoid the loop detection
error.
- send the message, using the sender and recipient as determined above.

you'll need a script. perl and friends are better at this stuff, but
shell may do (grep -m 1, sed, ...). you can of course start by splitting
the mbox into individual message files (aka maildir, but this is not
necessary).