Dear Users, I'm facing a problem with the header_checks. I want to flip the domainpart / userpart in the To: field of the mail header, strip off spaces/parentheses, add a custom domainpart and replace international number scheme ++49 -> 0049.
My input string is, recipients can vary - it might be only 1 or 50. To: =?windows-1252?Q?LHG_1_=28Fax_Gesch=E4ft=29?= <LHG 1@+49 (8621) 9960237>, =?windows-1252?Q?LHG_2_=28Fax_Gesch=E4ft=29?= <LHG2@+49 3212-1150047> My output string should be: To: =?windows-1252?Q?LHG_1_=28Fax_Gesch=E4ft=29?= <004986219960237@fax.local>, =?windows-1252?Q?LHG_2_=28Fax_Gesch=E4ft=29?= <004932121150047@fax.local> I have a working pcre but that only works for a single To: field recipient: /^To:\s*(.*)<.*@\+(\d+).*?(\d+).*?(\d+)>/ To: $1 <00$2$3$4@fax.local> root@srv1:/home/stefan# postmap -q "To: =?windows-1252?Q?LHG_1_=28Fax_Gesch=E4ft=29?= <LHG 1@+49 (8621) 9960237>, =?windows-1252?Q?LHG_2_=28Fax_Gesch=E4ft=29?= <LHG2@+49 3212-1150047>" pcre:/etc/postfix/rewrite_tofield To: =?windows-1252?Q?LHG_1_=28Fax_Gesch=E4ft=29?= <LHG 1@+49 (8621) 9960237>, =?windows-1252?Q?LHG_2_=28Fax_Gesch=E4ft=29?= <004932121150047@fax.local> Any help is greatly appreciated. Stefan