Child pages
  • Using postfix header_checks to re-write From headers

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

"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:":

  1. 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
  2. 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:

Reference