Jos
Jos

Reputation: 111

Postfix header checks multiple actions

I want to make a header check rule to add a reply-to and change From to a no-reply. I use it for sort of diffusion list adress

I have tried this regexp code but it is not working:

if !/^From:(.+@myserver\.fr)/
/^From:(.*)$/ PREPEND Reply-To:$1
/^From:(.*)$/ REPLACE From: [email protected]
endif

Only the first action is use.

Can someone explain me what I am doing wrong?

Upvotes: 3

Views: 9439

Answers (3)

Nelson Gonzalez
Nelson Gonzalez

Reputation: 91

The easy way that I found to fix something similar like this was, creating two files with regex sentences, to do this I edited the main.cf and I added these two files:

smtp_header_checks = regexp:/etc/postfix/header_checks
header_checks = pcre:/etc/postfix/add_original_rcpt.pcre

and I put one regex sentence in each file, and it works for me.

Upvotes: 1

Solairaj Murugesan
Solairaj Murugesan

Reputation: 1

Replace From header

The above syntax looks wrong try as below,enable header_checks with postfix main.cf

Append the lines as below in header_checks file,Next if u want to add Reply_To header next to From header,do as below

/^From:[[:space:]]+(.*)/ REPLACE From: [email protected],

Prepend or Add new Header .* explains next to

/^From:.*/ PREPEND Reply_To: [email protected]

If you want to set return path set using canonical_maps

Upvotes: 0

Farhad Farahi
Farhad Farahi

Reputation: 39387

The problem is with your match regex. You are matching the same header twice and thats not possible with header checks. if you can set the reply to in the email client you can just replace the from address with header checks and the case is solved.

if !/^From:(.+@myserver\.fr)/
/^From:(.*)$/ REPLACE From: [email protected]
endif

Upvotes: 1

Related Questions