Routing Emails from internal domain to external domain

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
BharathS
Advanced member
Advanced member
Posts: 50
Joined: Wed Nov 26, 2014 12:42 am

Routing Emails from internal domain to external domain

Postby BharathS » Thu Dec 24, 2020 5:59 am

Hello Everyone!,

I manage a zimbra collaboration 8.8 server, multiple domains in there, one of them moved out of zimbra but there are some people who still email from internal domains and it still gets routed inside internal MTA, like Domain1, Domain2 are in zimbra, Domain 2 MX got moved outside zimbra but when Domain1 sends mail to Domain2 within zimbra, it still routes email to mailbox thats in Domain2 in zimbra. I want to configure in a way it sends to domain2 external where the MX is pointed.

how can i achieve it? or domain rename/deletion is the only way?


User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 573
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 8.8.15_P20 RHEL6 Network Edition
Contact:

Re: Routing Emails from internal domain to external domain

Postby JDunphy » Thu Dec 24, 2020 6:30 pm

Should be able to do this with transport maps. Not tested but it would go something like this. Note: put the transport file where you think it makes the most sense for you and call it what you want. Could be in ~zimbra/common/conf with modern versions of Zimbra since that is where main.cf and master.cf are now located.

Code: Select all

# su - zimbra
% vi transportfile
% zmprov ms `zmhostname` zimbraMtaTransportMaps 'lmdb:/opt/zimbra/postfix/conf/transportfile proxy:ldap:/opt/zimbra/conf/ldap-transport.cf'
% zmprov gs `zmhostname` zimbraMtaTransportMaps
% postmap /opt/zimbra/postfix/conf/transportfile
% postfix reload

Where Transportfile is:

Code: Select all

domain2   smtp

Should force a MX lookup with domain2 ... if not... you can specify it explicitly like smtp:host.domain2 and/or use [] around the mail host if MX lookups are problematical with your environment because of something like RFC1918 space or other DNS split horizon configurations.

Ref: http://www.postfix.org/transport.5.html
BharathS
Advanced member
Advanced member
Posts: 50
Joined: Wed Nov 26, 2014 12:42 am

Re: Routing Emails from internal domain to external domain

Postby BharathS » Tue Dec 29, 2020 1:32 pm

Thank you, I will try this out!

JDunphy wrote:Should be able to do this with transport maps. Not tested but it would go something like this. Note: put the transport file where you think it makes the most sense for you and call it what you want. Could be in ~zimbra/common/conf with modern versions of Zimbra since that is where main.cf and master.cf are now located.

Code: Select all

# su - zimbra
% vi transportfile
% zmprov ms `zmhostname` zimbraMtaTransportMaps 'lmdb:/opt/zimbra/postfix/conf/transportfile proxy:ldap:/opt/zimbra/conf/ldap-transport.cf'
% zmprov gs `zmhostname` zimbraMtaTransportMaps
% postmap /opt/zimbra/postfix/conf/transportfile
% postfix reload

Where Transportfile is:

Code: Select all

domain2   smtp

Should force a MX lookup with domain2 ... if not... you can specify it explicitly like smtp:host.domain2 and/or use [] around the mail host if MX lookups are problematical with your environment because of something like RFC1918 space or other DNS split horizon configurations.

Ref: http://www.postfix.org/transport.5.html
BharathS
Advanced member
Advanced member
Posts: 50
Joined: Wed Nov 26, 2014 12:42 am

Re: Routing Emails from internal domain to external domain

Postby BharathS » Wed Dec 30, 2020 1:17 pm

How do I revert back to the original configuration once mapped the transportfile?
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 573
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 8.8.15_P20 RHEL6 Network Edition
Contact:

Re: Routing Emails from internal domain to external domain

Postby JDunphy » Wed Dec 30, 2020 3:25 pm

Two ways...

1) you have a blank transport file you postmapped so no lookup matches
2) you remove the transport file location and only use the ldap entry
ie) zmprov ms `zmhostname` zimbraMtaTransportMaps 'proxy:ldap:/opt/zimbra/conf/ldap-transport.cf'
BharathS
Advanced member
Advanced member
Posts: 50
Joined: Wed Nov 26, 2014 12:42 am

Re: Routing Emails from internal domain to external domain

Postby BharathS » Sat Jan 02, 2021 4:38 pm

Tried, it is still routing through internal MTA to internal domain, even with the explicit mx record url.

did not work :(

Return to “Administrators”

Who is online

Users browsing this forum: No registered users and 18 guests