postfix - Adding Mail header containing envelope to

LonelyStar

New Member
Hello,

I have a catchall on a certain domain (lets call it catch-all.com).
I want my my deliver agent to know to which address (in the envelope, not in the headers) the mail has been sent.

On my qmail system, I could add a header like this:
X-Envelope-To: something@catch-all.com

Using a spp-plugin.

Is there a way I can do this in postfix?
Is there some other way the MDA can know the envelope to?

Thanks!
Nathan
 
You could use check_recipient_access and a simple PCRE-map to prepend the X-Envelope-To header.

main.cf
Code:
smtpd_recipient_restrictions = [...], check_recipient_access pcre:/etc/postfix/prepend_header

/etc/postfix/prepend_header
Code:
/(.+)/		PREPEND X-Envelope-To: $1

Code:
# postmap -q localpart@example.com pcre:prepend_header
PREPEND X-Envelope-To: localpart@example.com
 
which version of postfix needed?

Hi, i have that same problem and i read many sites for solving. Also your
decision i tried, but doesn't work.
which version of postfix i need for that?

MOD: Bitte keine Fullquotes! Danke

regards
 
Last edited by a moderator:
Dear server support forum, I would like to add Envelope-To headers as well. However, it seems like when multiple aliases are supported by the incoming postfix and the To/CC contains multiple of them, the above solution will cause multiple X-Envelope-To headers rather than one combining them via a comma list. Does anybody happen to know if configuring this as a neatly comma separated list is doable?

(I might be wrong, but above solution also seems to me like it would possibly apply X-Envelope-To for outgoing mails as well, which might be undesirable. I wonder if there's a way to avoid that, too?)
 
Back
Top