I just put in a bug request for the inclusion of a x-original-to header:
but perhaps there is another way to deal with the problem I'm having.
I'm new to Zimbra, and I'm in the process of moving my domain from qmail to an existing Zimbra server. I have a fair amount of control over the way the Zimbra server is to be configured, which may help in finding a solution.
One of the tricks I've used over the years is to create a new email alias to give to each company that I do business with. Among other things, this lets me easily turn off an email address if someone starts using it for spam, and no other address is affected. It also lets me detect spam more easily; if I get an eBay email but it's not to my eBay address, I know I can ignore it.
I do a lot of filtering based on the alias to which the mail was sent. My old server gave me an X-Original-To header which made this easy. But Zimbra doesn't include this header. For most messages, I can get the recipient from To: or CC: headers. Failing that, I can look at the Received: headers, but even this isn't guaranteed to tell me what alias the message was sent to.
Perhaps the X-Original-To header was omitted by design, since it would make it hard to have a single-copy-per-message mail store. But it's been driving me nuts. I could probably add the envelope contents to every message as it comes in -- but this would violate the spirit of BCC addressing. I really want to just add this header to any mail that comes into a single mailbox, and I don't know how to do it.
Given that the domain is mine, I don't mind too much if I lose the privacy of BCC for all addresses in that domain; perhaps that would make a solution easier to implement?
I know there are a lot of clever people out there. Does anyone have any suggestions on how I might proceed? Perhaps a Postfix filter to selectively add headers to certain messages? Can I set this up as a daemon to cut down on the overhead of spawning a process with each message? Is there something I can set up on a per-user basis? (And, for you Electric Company fans out there: What about Naomi? :-)
So far, the best solution I have found is to create a real mailbox for each of the hundreds of aliases I now have, forward these to my primary mailbox, and then parse all the Received: headers to find the original recipient. The filtering job might be made easier if I can inject a special header into these messages before forwarding them. But the idea of creating hundreds of forward-only mailboxes seems kludgy to me....
Thanks in advance for any suggestions you might have.