what´s the best way to rewrite a sender address depending on the destination of the
message to be sent?
Assume you have the users foo, bar, baz and me. All of them can send and receive messages,
but foo is a "generic" account to which bar and baz have access to. When they send
outgoing messages, bar and baz can either send from their own accounts or from the generic
account. I´m using global address rewriting to rewrite everything sent by bar and baz to
foo.
So when bar or baz send an email, it appears to come from foo. When someone sends an answer,
the answer goes to foo (unless the sender changes the recipient address). This is desired
for email sent by baz or bar to non-local domains.
It is inconvenient for email sent by baz or bar which goes to a local domain: When they send
a message to me, I want my answer to go to the actual sender of the message rather than to foo
(without having to change the address from foo to baz or bar, which I sometimes forget to do).
So the address rewriting must depend on the domain to which baz and bar send messages. How
can I do that?