On Thu, Feb 17, 2011 at 09:43:05PM +0000, Adam Hamer wrote: > > Are you in fact forwarding email off-site or are you using lmtp(8) to > > deliver email into a Dovecot IMAP store? > > Off-site. Any ideas for which way to go to make those aliases have > the X-Original-To?
Aliasing via virtual(5) is brutally efficient. No content modification, just message routing, so the header is not added. To add an X-Original-Recipient header, messages to multiple recipients have to be split into one copy per-recipient since the header you want is recipient-specific. Since the queue file contains a single copy of the message for all recipients, such rewriting *cannot* happen on input, it can only happen on output via a delivery agent that is processing a single recipient. This means you need a custom transport for this destination that processes mail one recipient at a time and prepends the header. This can be done via an external program via pipe(8) or by modifying the source code of the smtp(8) delivery agent so that the header is added when a suitable boolean flag is set and the message has exactly one recipient. The pipe(8) approach would then re-submit the mail for outbound delivery to a different Postfix instance to avoid loops. -- Viktor.