...
"Mr Foo" <foo@example.com>
- display-name is
"Mr Foo"
is the display-name <foo@example.com>
is angle-addr is<foo@example.com>
The essential steps
Create /etc/postfix/header_checks (discussed below) then run these commands
...
The text
- display-name needs to include enclosing double quotes.
- angle-addr needs to include enclosing the < and > characters.
Development techniques
To find out what's after the "From:":
- If the regex matches the "From:" header, it can be seen in /var/log/mail.info using , the original headers can be displayed by
grep -o 'replace: header .*$' /var/log/mail.info
- It can be replicated to Keep the original header text in the re-written header by using ("me" is an arbitrary choice): back-substitution in header_checks like (replace <email_address>):
/^From:[[:space:]]+(.*)/ REPLACE From: ">${1}<" me<email_address>
Documentation
...
HOWTOs
There are few HOWTO pages on the Internet about this topic. The ones found most useful were:
Postfix sender address rewriting, changing mails “from” field in header on relay server (but beware < and > represented as "<" etc.): http://tech.gate.io/postfix-sender-address-rewriting-changing-mails-from-field-in-header-on-relay-server/
Missing full sender name in your sent email with postfix?: http://www.ifusio.com/blog/missing-full-sender-name-in-your-sent-email-with-postfix
Reference
- Postfix Architecture Overview: http://www.postfix.org/OVERVIEW.html
- Postfix Address Rewriting: http://www.postfix.org/ADDRESS_REWRITING_README.html
Postfix Lookup Table Overview: http://www.postfix.org/DATABASE_README.html
REGEXP_TABLE man page: http://www.postfix.org/regexp_table.5.html
- header_checks man page: http://www.postfix.org/header_checks.5.html