Score:0

Regexp for header_checks in postfix

om flag

All my users use outlook, so the From field reaches the postfix like this: From: "Name and Surname" [email protected]. I need a regular expression to change the address, I have this in the file header_checks:

/^(From: "(?:[^"]|"")*" <[email protected]>)$/ REPLACE From: "Reservas" <[email protected]>

and in the file main.cf have:

...
header_checks = pcre:/etc/postfix/header_checks
...

Conclusion, what I need iswhen the reservas1 and reservas2 email addresses send an email change the address for [email protected].

Thanks to anyone!

Score:0
in flag

What you are looking for is called Address Rewriting which is detailed in this postfix official page: here.

More precisely sender_canonical_maps since you are rewriting sender addresses.

1/ Create a file that contains the real sender address and the desired rewritten address, like so:

$ cat /etc/postfix/sender_canonical
[email protected] [email protected]
[email protected] [email protected]

2/ Point the sender_canonical_maps parameter to this this file in your main.cf:

sender_canonical_maps = hash:/etc/postfix/sender_canonical  

3/ postmap the file and reload postfix

$ sudo postmap /etc/postfix/sender_canonical
$ sudo postfix reload
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.