Relaying mails for recipients which are not known
I have setup a Kopano server like described in the Administration Manual. We are using Active Directory for user management and Postfix for mail delivery.
The Postfix configuration looks like:
virtual_mailbox_domains = example.com
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf
virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-groups.cf, ldap:/etc/postfix/ldap-groups-expand.cf
virtual_transport = lmtp:127.0.0.1:2003
Now we have some users with the same domain(virtual_mailbox_domains) which are not maintained by Kopano but a other mail system on another place.
I want to to relay all mails to these users to a specific host. Does anybody know how to setup postfix for that purpose.
Hello @FoxholeCommander ,
such a configuration can be achieved with transport maps in Postfix (either queried from ldap/ad or with a static map). You basically have to map the external addresses to the external mailserver.
what exactly did you set in your main.cf? Because its more than just a one line change.
Something like the following should do the trick for you:
transport_maps = hash:/etc/postfix/transportto you main.cf and create the file with the following content:
firstname.lastname@example.org smtp:[external.mx.de] email@example.com smtp:[external.mx.de]
With every modification of the transport file you have to call
in my config it wasn`t that simple and the transport_maps parameter was just a part of the solution. Additionally I had to make a hash table in the config line virtual_mailbox_maps. So now it looks like:
virtual_mailbox_maps = ldap:/…, has:/…
I’ve a similar problem: Many users are maintained by our local Kopano server, but as many users will be maintained by an external mailserver. I don’t know all of the external users, but all of my local users are listed in ldap.
How can I configure this?
Fortunately, the MX record for example3.at points to the external server, I use fetchmail to get the mails for my local users.
I removed example3.at from virtual_mailbox_domains in my postifx config, so every mail to an user *@example3.at will be delieverd to the external server. Is it possible to filter the local users?
virtual_mailbox_domains = example1.at, example2.at #,example3.at virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf,hash:/etc/postfix/virtual/addresses virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf,hash:/etc/postfix/virtual/addresses virtual_transport = lmtp:127.0.0.1:2003
transport_maps = ldap:/etc/postfix/ldap-transport.cf,hash:/etc/postfix/transport
This does not work: /etc/postfix/ldap-transport.cf
server_host = localhost search_base = ou=Users,dc=customerxyz,dc=local version = 3 scope = sub query_filter = (&(mail=%s)(kopanoAliases=%s)) result_attribute = mail result_format = kopano