On Wed, Apr 08, 2015 at 11:51:03AM +0300, Jonathan Bees wrote:

> I have one domain - example.com. And I'd like to have user mailboxes on two
> separate machines (policy differences), but ran into a problem with sending
> emails from a user on one machine to users on the other machine.
> The error message : 550 5.1.1 <remoteu...@example.com>: Recipient address
> rejected: User unknown in local recipient table

Both machines must accept all users in the domain.

> Partial postconf output:
> alias_maps = mysql:/etc/postfix/mysql-alias.cf
> mailbox_transport = cyrus
> mydestination = example.com, localhost.example.com, localhost, 
> mysql:/etc/postfix/mysql-mydestination.cf
> myorigin = /etc/mailname

Looks like the split domain is "local".  If such a domain is "local"
to multiple hosts, you need to use an aliases table that lists all the
users:

    aliases:
        user1:  us...@host1.example.com
        user2:  us...@host2.example.com
        ...

where host1 is listed in mydestination on host1, but not on host2,
and conversely host2 is in mydestination on host2, but on host1.

    mydestination =
        $myhostname,
        example.com,
        localhost.example.com,
        localhost,
        mysql:/etc/postfix/mysql-mydestination.cf

Alternatively, (and I what I actually recommend) you can make the
example.com domain be a virtual alias domain, and use virtual alias
maps to rewrite recipient addresses:

    virtual:
        us...@example.com       us...@host1.example.com
        us...@example.com       us...@host2.example.com

Then on each host:

    mydestination =
        $myhostname,
        localhost.example.com,
        localhost,
        # possibly instead the mysql domains become virtual
        mysql:/etc/postfix/mysql-mydestination.cf

    virtual_alias_domains =
        example.com
        # possibly the mysql domains become virtual
        # mysql:/etc/postfix/mysql-virtual-domains.cf

> receive_override_options = no_address_mappings

Not generally a good idea as a global setting.  What are you doing with that?

> transport_maps = hash:/etc/postfix/transport
> virtual_alias_maps =
>       mysql:/etc/postfix/mysql-virtual.cf,
>       mysql:/etc/postfix/mysql-virtual-example.cf,
>       hash:/etc/postfix/virtual

Generally, list the indexed first, those queries are faster.

> Hoping someone knows a good way to send all unknown recepients in local
> tables (referred by mysql-virtual.cf) to a smarthost (192.168.1.1), which
> would decide whether to forward this to the remote server or answer with a
> bounce message.

No need to route through the smarthost if this is an MTA hosting mailboxes.
Only punt to the smarthost from null-client machines that punt everything.

-- 
        Viktor.

Reply via email to