> I am tasked to design, build and maintain a new MTA. The company has
> one special requirement, for which I'm investigating the simplest
> solution:
>
> For each incoming message received, every outgoing "reply" must use
> the "To:" address from the incoming received message as the "From:"
> address in the outgoing reply.
If you cannot assume any backend MUA cooperation or setup, I
believe that your only completely reliable choice is to rewrite the
origin address of incoming email in the MTA (in both the envelope
and in the From:/Reply-To:/etc headers). The simplest approach
would be to just make up random local destination addresses (say
'outside-<random>@<yourdomain>') and maintain a database of what each
'outside-<random>' requires as the local From: and the destination To:
address(es). You probably want these to be long-term database entries
given MUA address books and so on.
(This gets all sorts of challenging in the face of multiple recipients,
especially if you want them to be able to cc: each other on replies. Life
is simpler if you can assume that this doesn't happen.)
As everyone else has have said, this will be much easier with MUA
cooperation, including if you can deliver different To: addresses to
different mailboxes (even for the same person) and then have MUA rules
for what mailbox gets what From: address. Other options are, eg, adding
a new header like 'X-Originally-To:' and then having a MUA thing that
grabs that as the From: for replying to it.
- cks