I'm not sure I'm doing this the right way...
I have sendmail and procmail is my MDA on one of my machines. I'm hosting
a few domains. For a given domain, for example, "foo.com" I have sendmail
deliver to all messages to local user "foo".
Now, I want to forward on message sent to admin(_at_)foo(_dot_)com to one
another domain), webmaster(_at_)foo(_dot_)com to someone else, and so on.
create mail aliases.
I set and X-Envelope-To:, and then I use that to match the domain's valid
address and forward onto the right person. For example:
# -- (Webmaster: Bill Moseley )
The problem is bounces. If moseley(_at_)hank(_dot_)org is a bad address the
comes back to "foo" on this machine, not back to the *original* sender.
So what I need to do is reliably extract the address from the Return-Path:
when the message first comes in, and then set SENDMAIL-FLAGS -oi -f
$RETURN_PATH. I can set Sender: and Errors-To: also, if needed, to make
sure that bounces go back to the original sender.
Yes, I have this user's ("foo") account set as a trusted user so I can use -f.
How would I accomplish this?
All this seems rather hackish. Is there a better way to do this mail
forwarding with procmail?
 Boring details:
The reason I'm using procmail for this is the web site for this domain is
hosted at he.net, but he.net's mail setup is a bit hosed. They use
procmail as the MDA, but they do not set the X-Envelope-To:, so it's
impossible to know who the mail was addressed to and multi-drop to the same
domain causes all messages to be delivered as a single message.
The email alias mapping is maintained in a database on the web site. When
that changes on the web site a message is sent to my machine, and the my
machine fetches the mappings and writes the .procmailrc file.
procmail mailing list