postfix-users April 2010 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: redirect local(8) delivery to $local@$myd

Re: redirect local(8) delivery to $local@$mydomain ?

From: James Lever <j_at_nospam>
Date: Thu Apr 08 2010 - 11:59:54 GMT
To: Postfix users <postfix-users@postfix.org>

On 25/03/2010, at 11:43 AM, James Lever wrote:

> This still doesn’t solve the issue of local destination mail - mail sent via “mail user” or “mail user@$myhostname” from the local system still gets delivered to the mail spool. This is the key part that I’m still trying to solve.

For anybody else that comes along, I discovered 2 methods to easily do what I wanted.

Method 1:

Enable envelope_sender masquerading (non-default behaviour).

edit masquerade_classes to include envelope_recipient, for example:

  masquerade_classes = envelope_sender, envelope_recipient, header_sender, header_recipient

along with

  masquerade_domains = $mydomain
  masquerade_exceptions = root, mailer-daemon, logwatch

Method 2:

This method can provide significantly greater flexibility, but bypasses all local delivery attempts including alias expansion, so any aliases need to be defined in /etc/postfix/virtual and the regexp needs to exclude it (from my minimal testing of this method)

  local_transport = virtual
  virtual_alias_maps = regexp:/etc/postfix/virtual

in /etc/postfix/virtual have an entry similar to this

    /(.*)@/ $1@somedomain.com

Hopefully that’s the right way to do the second one.

cheers,
James