On Thu, Feb 24, 2011 at 09:26:59AM +0000, Jonathan Tripathy wrote:

> I have a postfix box which handles some smtp accounts for example.com. Not 
> all example.com accounts are located on this postfix box, but are located 
> elsewhere on another server.
>
> At the minute, for the accounts which aren?t on this server, postfix is 
> saying "user unknown in virtual mailbox table" (which is to be expected). 
> However, how do I make postfix go to another server, if at first the 
> account isn't on this server?

Add virtual aliases:

    main.cf:
    indexed = ${default_database_type}:${config_directory}/
    virtual_alias_maps = ${indexed}virtual
    transport_maps = ${indexed}transport

    virtual:
    remote-u...@example.com             remote-u...@remote-server.example.com

    transport:
        # Omit [] if the remote domain is MX-record based
        remote-server.example.com       relay:[remote-server.example.com]

you're done if the remote server can handle the resulting address form.
If not, you rewrite the address back to the original for en-route:

    main.cf:
    relay_generic_maps = ${indexed}relay_generic

    generic:
    remote-u...@remote-server.example.com       remote-u...@example.com

    master.cf:
        relay     unix  -       -       n       -       -       smtp
            -o smtp_fallback_relay=
            -o smtp_generic_maps=${foo_generic_maps}

The other option is identity mappings in the virtual alias table, and
per-user transport entries (which I don't recommend since this usually
forces the transport table into database, but it is best left a local
indexed file).

-- 
        Viktor.

Reply via email to