0

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

/^(From: "(?:[^"]|"")*" <reservas1@domain.co.cu>)$/ REPLACE From: "Reservas" <reservas@domain.co.cu>

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 reservas@domain.co.cu.

Thanks to anyone!

roch3
  • 1

1 Answers1

0

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
reservas1@domain.co.cu reservas@domain.co.cu
reservas2@domain.co.cu reservas@domain.co.cu

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
FatRabbit
  • 136
  • 5