On 2021-06-11 15:12, Viktor Dukhovni wrote:
I will make a bold guess that the real problem you're trying to solve
dealing with mail from "root" and similar system users, where in a
network of null-client hosts delivering all mail to a central mail hub,
you want the sender address to clearly reflect where the mail came
from.
See: http://www.postfix.org/MULTI_INSTANCE_README.html#split for a
walk-
through of how to configure such null-client instances.
Yes, I want null client per se, but not sure I need a multi-instance
setup. It looks overly complicated for what I am trying to accomplish.
Plus, in the example Makefile it still looked like a static map was
being set per user. I need users who login with AD credentials (who do
not have accounts in a passwd file), to be able to send mails, but as
you have guessed, I want to include the server name in the user section
of the FROM address instead of include hostname the @domain section
(project's requirement).
If you really want to do this for arbitrary sender local parts, you'll
need a regexp or pcre table, and for bonus points some care to get it
right for quoted local-part addresses.
/^"(.*)"@local\.domain$/ ${1}-hostname@some.domain
/^(.*)@local\.domain$/ ${1}-hostname@some.domain
But, unless you have "-" as your recipient delimiter on the central
mailhub, the resulting sender address is invalid, which is best
avoided.
I will use a different delimiter ("+"). Thank you for the tip.
If I am going to do PCRE table can I still use generic map, or do I need
to use something like smtp_header_checks?
Thank You.