Postfix with split delivery

Discussion in 'Server Operation' started by Arun M, Jun 2, 2020.

  1. Arun M

    Arun M New Member

    We have Mail server configured on Postfix, Dovecot with MySQL back-end and GUI manager as PostfixAdmin , where we have created virtual domains and users successfully also relay is working fine .

    Now the requirement is for a particular domain, we need split delivery configuration. So unknown users from our legacy server will route to secondary host (google) and vise versa.

    could anyone please assist us on this ?
     
  2. Steini86

    Steini86 Active Member

    I don't understand. So you have two servers, which have the same domain? And then you want mails which are delivered to one system to an unknown user to be relayed to the other server?

    You can create a catch-all account and forward this to another address
    What do you mean by vice versa?
     
  3. Arun M

    Arun M New Member

    Yes we have same domain on two servers, so virtual users will check locally first and if not available it should forward to secondary host.
     
  4. elmacus

    elmacus Active Member

    Didnt know that was possible. Did you check on Postfix website docs ?
    I follow to see if anyone solved this.
     
  5. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    there's instructions here: https://gist.github.com/iredmail/fda90a4fd0fc4453f6a2c6c18638e047 for doing this on iredmail, which uses postfix, it'll need adapting a bit, and looks like it requires db changes, you'd also need to change the given MySQL queries to match the ispconfig field names. but it should be doable. I highly doubt it'll be supported by ispconfig though.
    I don't know if there's an official ispconfig way to do this. it's not the sort of thing I've ever needed or tried to do.
    it might be enough to point you in the right direction for a way to do it in ispconfig that doesn't required unsupported modifications.
     
  6. Arun M

    Arun M New Member

    Yes it's possible, even i have done on our old postfix server through transport_maps --> hash:/etc/postfix/transport file
    with the entry of <domainname.com> relay:<secondaryhost address>
    But here I am using virtual users, it resides on MySQL so i need to alter virtual transport and DB queries.
    I am not expert on MySQL, however i am trying to solve this.. I ill post here if i got succeed ...
    Meanwhile can somebody help me !!
     
  7. Arun M

    Arun M New Member

    Thank you man, I have got this same document by googling but i stuck on below..
    Relay is successfully happening on all other domains..
    My issue is where split delivery is enabled, Postfix starts relay email directly to secondary host without verifying to local virtual users, so once user available on secondary host it will deliver else its looping.

    My configuration is as below, can somebody help me on this?
    Domain table <image attached>
    main.cf --> configuration
    transport_maps = proxy:mysql:/etc/postfix/mysql-transport-maps-split.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf, proxy:mysql:/etc/postfix/mysql-virtual-alias-domain-mailbox-maps.cf, proxy:mysql:/etc/postfix/mysql-virtual-mailbox-split.cf

    mysql-transport-maps-split.cf :
    user = user
    password = password
    hosts = 127.0.0.1
    dbname = postfix
    query = SELECT split_transport FROM domain WHERE domain='%s' AND backupmx=0 AND split_transport<>'' AND active=1
    mysql-virtual-mailbox-split.cf:
    user = user
    password = password
    hosts = 127.0.0.1
    dbname = postfix
    query = SELECT split_transport FROM domain WHERE NOT EXISTS (SELECT maildir FROM mailbox WHERE username='%s' AND active='1') AND domain='%d' AND backupmx
    =0 AND split_transport<>'' AND active=1
     

    Attached Files:

  8. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    what do you have in your mailbox table?

    you may have to install a test iredmail server and create a few test accounts/mailboxes and compare the iredmail forwardings table with your mailbox table.
     
  9. Arun M

    Arun M New Member

    Hi Guys thanks for your support... :)
    I have solved this myself.. Solution is below.
    I am using virtual transport as: virtual_transport = upload_2020-6-8_13-4-11.png
    And to configure split delivery(Remote Host) as mentioned above i have altered the MySQL DB table.
    To verify the local user I have modified trasport maps as :
    transport_maps = hash:/etc/postfix/transport, proxy:mysql:/etc/postfix/mysql-transport-maps-split.cf
    On transport file, we need user vise entry is required.
    <[email protected]> upload_2020-6-8_13-3-59.png
    with this split delivery will happen for domain on both the hosts.
     

    Attached Files:

Share This Page