!/^Reply-To/ prepend Reply-To: "Support" <sup...@ourdomain.org>
However, since the check is being applied to each header line we get a bunch
of reply-to's prepended instead of just one. Is there a regex we can use to
say:
If no reply-to header exists anywhere in the headers
then prepend one reply-to header
Thanks,
Todd
--
View this message in context: http://old.nabble.com/Adding-a-reply-to-header-when-none-is-present-tp30429730p30429730.html
Sent from the Postfix mailing list archive at Nabble.com.
As documented, header_checks makes a decision one header at a time,
and does not remember decisions from one header to the next.
I suggest that you fix the problem in the program that creates the
message.
If you must repair this in Postfix, then you need to use an external
content filter (http://www.postfix.org/FILTER_README.html) or a
Milter application (http://www.postfix.org/MILTER_README.html).
Wietse
no, you can't. postfix header_checks work on one header at a time. so
there's no way to have a rule that works on all the headers. and in
particular, there's no way to specify a rule that says if "$header
doesn't exists".
you need to tell us a little about your problem more so we can help.
As others have already said: header_checks inspects one header at a time,
not all headers as a whole.
If your mail goes through Postfix only once, you could try prepending
some unique header (e.g. Subject or Message-ID) with the Reply-To
header:
if /^message-id:/
/^message-id:/ PREPEND Reply-To: "Support" <sup...@example.org>
endif
However, that's merely a workaround (and an ugly one at that), not a
real solution.
And please use RFC 2606 domain names instead of some made-up fake domain
that may actually be a real domain belonging to someone else. That's why
the domains in RFC 2606 are reserved after all.
Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky
That will add the Reply-To: header to all messages and may cause more
than one such header to appear in a message, which would be incorrect
(RFC 5322, section 3.6, page 20).
if OP wants to remove previously set Reply-To headers, then he can use
/^(Reply-To:.*)/ REPLACE X-WAS-$1
together with your suggestion.
he could also stack multiple smtpd listeners with their own cleanups and
header_checks. but that's a bit convoluted. so unless OP tells us more, ...