| Main Archive Page > Month Archives > postfix-users archives |
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