On Wed, Jan 27, 2021 at 07:05:37PM +0100, Andy Smith wrote:
> In my case it is safe to assume that all mail from this user (www user)
> will always have "Reply-To" as they are generated by the program Request
> Tracker which always includes this header. If it were an issue I guess
> before the rewrite I could add a reply-to header if it doesn't already
> exist? So in a typical message header we might have:
>
> From: "WWW" <[email protected]>
> Reply-To: [email protected]
>
> And I want to rewrite [email protected] with [email protected]. The
> reply-to value is variable, the from field is static.
Does the MTA in question handle email exclusively from this user and
nobody else?
> > There is no equivalent feature built-in to Postfix. If you want to
> > modify a message based on the value of the "Reply-To:" or else "From:"
> > address of a message, you'd need a content_filter or milter.
>
> If we assume that reply-to exists does that make this easier?
If absolutely every single message is guaranteed to have a "Reply-To:"
that can safely replace "From:", then you could in theory forcibly
remove "From:" from every message, and upon encountering "Reply-To:"
generate a new matching "From:" (via header_checks defined for the
cleanup(8) instance configured for pickup(8)).
However, I very much doubt that your MTA is sufficiently dedicated to
just mail from this one user. If you had a multi-instance configuration
with a dedication null-client instance for just "www" (perhaps PHP or
whatever can be configured to run "sendmail -C /etc/postfix-www ..."
instead of "sendmail ..."), then perhaps this would be an option.
If the Postfix instance also handles mail from any other source,
then Postfix built-in header rewriting cannot do what you ask,
and you need a milter or content_filter. Amavis, for example,
has sufficient hooks for this.
--
Viktor.