I'm using Postfix MTA and get important mails in from a broken MTA (which I can't fix because it's not under my control), which sends in the following format:
RCPT TO: <+49 (681) 12345678>
What I need is:
RCPT TO: 4968112345678
So I am looking for a regex, which first checks if the string begins with "RCPT TO:" and if this is true, it needs to remove all special characters after it, so that only [a-zA-Z0-9] are left.
Postfix ships an example for such regex'es:
# Work around clients that send RCPT TO:<'user@domain'>.
# WARNING: do not lose the parameters that follow the address.
#/^RCPT\s+TO:\s*<'([^[:space:]]+)'>(.*)/ RCPT TO:<$1>$2
But after several hours I am unable to adapt it to my needs.
Thanks in advance, Marco