Is there a solution to force postfix to check the MX of a domain name ?

5 posts / 0 new
Last post
#1 Fri, 03/18/2016 - 13:44
thesmahesh

Is there a solution to force postfix to check the MX of a domain name ?

Dear All,

Environment: Operating system CentOS Linux 7.2.1511 Webmin version 1.791

Let's say my server's hostname is site.com. I also run various web based software packages, which send out e-mail to customers. This works great. The problem is that my server also sends out e-mail to user@site.com.

The problem is that the site.com e-mail is not hosted on this server, it's actually hosted on a 3rd party e-mail server, so I am not getting these e-mails. Is there a way of forcing Postfix to use the MX records for site.com, even if this is the local name of the server? The server will not be receiving ANY e-mail, just send out.

I made given below changes

  1. in /etc/postfix/main.cf mydestination = $myhostname transport_maps = hash:/etc/postfix/transport

  2. nano /etc/postfix/transport site.com.com relay:site.com

  3. postmap /etc/postfix/transport postfix reload

But, postfix still tries to deliver the mail locally and returns an error saying "Recipient address rejected: User unknown in virtual alias table" Bind DNS server is running in the server. But none of the domains hosted in the server use the local nameservers and all of them use external nameservers.

I want a solution to force postfix to check the MX of all the domains (EXTERNALLY, and NOT based on the mx entries in my local Bind DNS Server ) hosted in my server and do the delivery of mails based on the mx records. If mx record of domain1 is local, let it deliver locally, if the mx record of domain2 is external mail server, let it deliver externally (even if domain2 is hosted locally)

Please help in getting this resolved.

Thanks and Regards

Fri, 03/18/2016 - 23:59
andreychek

Howdy,

Hmm, is it an option to change your server's hostname to an FQDN such as host.site.com?

Then, email for site.com can be hosted externally, and Postfix will only try to deliver host.site.com email locally.

-Eric

Sat, 03/19/2016 - 08:47 (Reply to #2)
thesmahesh

Hello Eric, The server's FQDN has already already been set to: host.site.com But still postfix tries to deliver mails locally not only to site.com but for all the domains hosted in the vps. Please help how to get rid of this postfix behaviour and force postfix do a mx lookup externally for all the domains. (BTW, if this can't be achieved with postfix, can i uninstall postfix and install Qmail? ) Thanks and Regards

Wed, 05/04/2016 - 10:39
thesmahesh

Dear All, Can i have help on this please? Thanks and Regards

Wed, 05/04/2016 - 16:09
andreychek

Howdy,

It shouldn't be a problem to achieve what you're after, though it sounds like something is "gumming up the works" at the moment, I'm just not sure what quite yet.

Do you by chance have a Virtual Server with the same name as your hostname? That is, is "host.site.com" also setup as a Virtual Server? If so, are you by chance able to delete that, and see if that resolves your issue?

Note that the other thing is that if email is being hosted externally, not locally -- you'd want to ensure that the Mail for Domain feature is disabled for the domains in question. Having Mail for Domain enabled will also cause Postfix to ignore the DNS settings and always deliver locally.

I would also recommend disabling BIND DNS Domain for any domain that has DNS hosted elsewhere, as that can cause some unusual issues.

-Eric

Topic locked