transport
Route mail in zimbra using transport
Zimbra OSE 8.8
dit the transport file :
vim /opt/zimbra/common/conf/transport
add the smart relay for specific domain :
gmail.com :[smtp.example.com] yahoo.com :[relay.abcd.com] user1@xyz.com :[mail.worldcm.net]:587
login to zimbra user by :
su - zimbra
Run below command to generate binary :
postmap /opt/zimbra/common/conf/transport
and finally, run below zommand to update zimbra :
# zmprov ms 'zmhostname' zimbraMtaTransportMaps "lmdb:/opt/zimbra/common/conf/transport,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
# zmcontrol restart
--------X----------
Zimbra 8.7
1. Backup first main.cf (user: root)
# cp /opt/zimbra/common/conf/main.cf /opt/zimbra/common/conf/main.cf.backup
2. Edit the main.cf file (user: root), add the following line at the bottom
sender_dependent_relayhost_maps = lmdb:/opt/zimbra/common/conf/bysender
3. Create bysender (user: zimbra)
su - zimbra
vi /opt/zimbra/common/conf/bysender
add the following line, then save
@gmail.com [smtp.abc.net]
test@yahoo.com [smtp.xyz.com]
when using a port, e.g. port 26
@gmail.com [smtp.abc.net]:26
test@yahoo.com [smtp.xyz.com]:26
4. Create a hash file (user: zimbra)
postmap /opt/zimbra/common/conf/bysender
5. Restart MTA Zimbra (user: zimbra)
zmmtactl stop; zmmtactl start
Done
How to set transport in zimbra
How to set transport in Zimbra 8.x
Transport feature allow you to route specific domain mail from different server/Host. Here i am going to route yahoo.com, gmail.com mail from another server.
Server details
Zimbra server hostname: mail.example.com
In example.com cpanel/domain create A record with name relay.example.com domain and point ip address of remote server .
relay.example.com - x.x.x.x
For zimbra 8.x
# su - zimbra
$ zmprov ms mail.example.com zimbraMtaTransportMaps "lmdb:/opt/zimbra/postfix/conf/transportfile,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
For zimbra 8.7.0 or above
$ zmprov ms mail.example.com zimbraMtaTransportMaps "lmdb:/opt/zimbra/common/conf/transportfile,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
Check above updated value
$ zmprov -l gs `zmhostname` | grep -i zimbraMtaTransportMaps
zimbraMtaTransportMaps: lmdb:/opt/zimbra/common/conf/transportfile,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf
Edit file main.cf and add below parameter
$ vim /opt/zimbra/postfix/conf/main.cf
smtp_sasl_password_maps=texthash:/opt/zimbra/conf/relay_password
smtp_sasl_auth_enable=yes
smtp_cname_overrides_servername = no
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain,login
Note: make sure above parameter is not repeating in main.cf file . If you find repated parameter remote that line from file carefully.
Create your transport file (owner/group-owner should be zimbra):
$ vi /opt/zimbra/postfix/conf/transportfile
gmail.com :[relay.example.com]
yahoo.com :[relay.example.com]
$ postmap /opt/zimbra/postfix/conf/transportfile
Create authentication file
$ vim /opt/zimbra/conf/relay_password
relay.example.com relay@example.com:passwordhere
$postmap /opt/zimbra/conf/relay_password
Note: On remote server create domain example.com with email id and password. Put the same information in relay_password file.
Update postfix conf file
$postfix reload
Test now mail gmail.com and yahoo.com mail should relay from relay.example.com server.
-------X--------
How to setup mailertable in zimbra
Transport tables allow you to relay/route emails to a different mail server. In this example I am forwarding all emails for otherdomain.com to smtp.otherdomain.com . You can add as many transport maps as you need.
Create your transport file
$vi /opt/zimbra/postfix/conf/transportfile
otherdomain.com :[smtp.otherdomain.com]
Example,
Gmail.com :[mail.xyz.com]
Update transportfile
$ postmap /opt/zimbra/postfix/conf/transportfile
Run below command to set transport
For zimbra 8.6
$zmlocalconfig -e postfix_transport_maps="texthash:/opt/zimbra/postfix/conf/transportfile proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
For below zimbra 8.6
$zmlocalconfig -e postfix_transport_maps="hash:/opt/zimbra/postfix/conf/transportfile proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
$zmcontrol restart