postfix-users October 2010 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: Rewrite From field if blank

Re: Rewrite From field if blank

From: Wietse Venema <wietse_at_nospam>
Date: Wed Oct 27 2010 - 16:47:22 GMT
To: Postfix users <postfix-users@postfix.org>

TheArchiveMan:
>
> We use Postfix to relay mail. Usually the From field is filled in and the
> mail is sent on. However, on occasion, the From field is blank and needs to
> be filled in. Is it possible for Postfix to sense that if the From field is
> filled in, leave the From field alone but if it is blank, populate it with
> something for the from address so that it is not blank?

What do you mean with a blank (i.e. not filled in) From: header?

With "local_header_rewrite_clients = permit_mynetworks" Postfix
rewrites headers from "local" clients as follows:

- IF THE MAIL HAS NO FROM: HEADER POSTFIX WILL ADD ONE with the
  envelope sender address.

- If the mail has a From: header then Postfix will rewrite addresses
  in that header as documented for canonical_maps, masquerade_domains,
  append_dot_myorigin and append_at_mydomain. If there is no address
  in the From: header then it is not rewritten.

That's all the built-in rewriting for headers from local clients.

You can also use REPLACE actions in header_checks but that will
also change mail from remote clients.

        Wietse