First of all, I love languages. I’m fluent in four and a half of them and have no doubts that the variety of languages is a vital part of our human culture. However …
Well before WWW saw the day of light, people had already communicated on the early internet by use of email and Usenet. They had agreed on the use of “Re:” in the subject to denote “this is a followup to your recent mail”. For Usenet, this was formally codified 1983 in RFC 850 and later for email in RFC 2822.
Unfortunately, some modern mail clients (most notably Outlook) don’t care. They interpret “Re” as short for “response” and thus translate it to other locales. A german Outlook user therefore prefixes “AW” and I’m sure many more such prefixes exist in other languages – a clear breach of standards.
To make things worse, if two email clients with different locales pingpong a message, the subject line sprawls on every response: “Hello”, “Re: Hello”, “AW: Re: Hello”, “Re: AW: Re: Hello” and so forth. Since modern email clients group messages by the “Re”-stripped subject, they will fail to do so in the above case if they stick to the standards. What a mess!
Postfix offers an easy way to rewrite subject lines by use of regular expressions. Please note that my examples rely on PCRE (Perl compatible regular expressions), so make sure your Postfix is compiled with PCRE support. If postconf -m | grep pcre doesn’t return anything, your Postfix does not yet do so.
Now create the file /etc/postfix/header_checks with the following content:
/^Subject:s*((Fwd|WG):s*)+(.*)$/ REPLACE Subject: Fwd: $3
/^Subject:s*((Re|AW|Antwort):s*)+(.*)$/ REPLACE Subject: Re: $3
These two lines replace and collapse the german translations of “Re” and “Fwd” with their standard complient counterparts. You may add other languages to the list such as the danish “Svar”. Please drop a comment below since I’d like to compile a more comprehensive list of translations out there.
Now we’re ready to apply these checks. Edit the file /etc/postfix/main.cf to contain:
header_checks = pcre:/etc/postfix/header_checks
Finally, reload or restart Postfix and send yourself an email with a subject such as “AW: Re: AW: AW: Hello World” for testing.
Comments
Sven, you cannot postmap a PCRE map.
The whole section
This header_checks file has to be converted to header_checks.db now with:
postmap /etc/postfix/header_checks
needs to go.
Re: I wasn’t aware of this, thanks for the hint!