Reporting back with successful results and a few notes:
https://www.postfix.org/header_checks.5.html says I can use pcre or regexp.
It took me seversl iterations to discover I do not have pcre available with
“postconf -m”
So, I added
header_checks = regexp:/etc/postfix/header_checks
to /etc/postfix/main.cf
And I created /etc/postfix/header_checks containing:
/^From: blah@example\.com/ PREPEND Reply-To:
[email protected]<mailto:[email protected]>
… and restarted postfix.
** NOTE** Mr. Venema’s example has a colon following “PREPEND”. This caused an
error:
postfix/cleanup[0000000]: warning: unknown command in header_checks map:
PREPEND: Reply-To: [email protected]
Removed the colon and it works !
Thanks.
From: <[email protected]> on behalf of Daniel White
<[email protected]>
Date: Thursday, June 30, 2022 at 10:10
To: Postfix users <[email protected]>
Subject: [Non-NASA Source][EXTERNAL] Re: How can I set a "Reply-To" header ?
I will try the Postfix built-in header_checks – PREPEND
I will also post my results.
Thank you for the details.
From: <[email protected]> on behalf of Wietse Venema
<[email protected]>
Reply-To: Postfix users <[email protected]>
Date: Thursday, June 30, 2022 at 09:53
To: Postfix users <[email protected]>
Subject: Re: How can I set a "Reply-To" header ?
White, Daniel E. (GSFC-770.0)[AEGIS]:
I found out how to do it from command line:
echo -e "Testing Mail\nThank you" | mailx -v -s "Testing Mail" -S
"[email protected]<mailto:[email protected]>"
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
This smells like a common webserver problem, where the webserver
submits email messages that appear to come from rhe web server's
UNIX account ([email protected]<mailto:[email protected]>). Adding a
Reply-To: header
is the WRONG solution for that. Instead, specify the correct
envelope sender address:
/usr/bin/sendmail -f [email protected]<mailto:[email protected]>
recipient....
If that is not your problem, read on for more.
Is there a way to add a 'Reply-To' header from the Postfix configuration ?
You can use milter-regex to inspect email and add or change headers.
You can use Postfix built-in header_checks to PREPEND a header but
that will add the header even if the message already has a Reply-To
header.
/^From: blah@example\.com/ PREPEND: Reply-To:
[email protected]<mailto:[email protected]>
The example needs to be tweaked to the exact form of your
message headers.
I looked in the documentation but could not find anything about
setting such a header, conditionally or otherwise.
Yeah. There is nothing about adding REPLY-TO headers.
Wietse