Google Gruppi non supporta più i nuovi post o le nuove iscrizioni Usenet. I contenuti storici continuano a essere visibili.

Adding a reply-to header when none is present

866 visualizzazioni
Passa al primo messaggio da leggere

thussvm

da leggere,
10 dic 2010, 15:23:2110/12/10
a

Because of a domain move we're doing, we're trying to add a reply-to header
in postfix when no reply-to header is already present. The rule we're using
is:

!/^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.

Wietse Venema

da leggere,
10 dic 2010, 15:43:2110/12/10
a
thussvm:

>
> Because of a domain move we're doing, we're trying to add a reply-to header
> in postfix when no reply-to header is already present. The rule we're using
> is:
>
> !/^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

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

mouss

da leggere,
10 dic 2010, 15:44:5010/12/10
a
Le 10/12/2010 21:23, thussvm a écrit :
>
> Because of a domain move we're doing, we're trying to add a reply-to header
> in postfix when no reply-to header is already present. The rule we're using
> is:
>
> !/^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
>


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.

Ansgar Wiechers

da leggere,
11 dic 2010, 11:31:3111/12/10
a
On 2010-12-10 thussvm wrote:
> Because of a domain move we're doing, we're trying to add a reply-to
> header in postfix when no reply-to header is already present. The rule
> we're using is:
>
> !/^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

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

mouss

da leggere,
11 dic 2010, 13:59:0611/12/10
a
Le 11/12/2010 17:31, Ansgar Wiechers a écrit :
> On 2010-12-10 thussvm wrote:
>> Because of a domain move we're doing, we're trying to add a reply-to
>> header in postfix when no reply-to header is already present. The rule
>> we're using is:
>>
>> !/^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
>
> 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
>

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, ...

0 nuovi messaggi