<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta name="Generator" content="Zarafa WebAccess v7.1.7-42779">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>[halb OT] pcre für Postfix-Adressumschreibung</title>
<style type="text/css">
body
{
font-family: Arial, Verdana, Sans-Serif ! important;
font-size: 12px;
padding: 5px 5px 5px 5px;
margin: 0px;
border-style: none;
background-color: #ffffff;
}
p, ul, li
{
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<p>Hallo nach München und Umgebung,</p><p> </p><p>ich habe hier ein kniffliges Problem und verzweifle an der Lösung. Mit Postfix gibt es die Möglichkeit, das To: Feld im E-Mail Header umzuschreiben.</p><p> </p><p>Das klappt mit meiner Regex prima für einen Empfänger - bei mehreren Empfängern gehen mir die Ideen aus, wie ich das umsetzen kann:</p><p> </p><p>Mein Input-String ist:</p><p> </p><p>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></p><p> </p><p>Mit folgender Anweisung setze ich den String um:</p><p> </p><p>/^To:\s*(.*)<.*@\+(\d+).*?(\d+).*?(\d+)>/ To: $1 <00$2$3$4@faxmaker.com></p><p> </p><p>Auf der Kommandozeile sieht man auch das Ergebnis (leider nur beim letzten Empfänger):</p><p> </p><p>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_tofieldTo: =?windows-1252?Q?LHG_1_=28Fax_Gesch=E4ft=29?= <LHG 1@+49 (8621) 9960237>, =?windows-1252?Q?LHG_2_=28Fax_Gesch=E4ft=29?= <004932121150047@faxmaker.com></p><p> </p><p>Danke</p><p> </p><p>Stefan</p>
</body>
</html>