virtual domain email is from 3rd party provider, nameserver is causing bounced emails

A few of our clients have a premium email service that we have pointed the domain MX records to. When I try to email the client from our server, the email is bounced, because the nameserver is pointing the email back to our server instead of looking at the domains MX record. Is there something I can change to have the mail server look at the MX records instead of the nameserver?

Hrm, I’m not entirely certain I understand the problem.

When sending email, the system will query the domains nameservers (ie, the 2-3 nameservers set in the registrar, typically and to determine the proper MX record to send to.


Unless the DNS service that the server is using has records for that domain – it will then take them from the local DNS server rather than tracking down the nameservers listed with your domain.

But, from your description above, it sounds as if, somewhere along the line, some MX records aren’t set correctly.

I hope the above is helpful in some way; if not, we’ll probably need some more information about your setup :slight_smile:


Your ‘unless’ is the correct scenario.

We are hosting the website for the domain, the email for the domain is hosted by myoutlookonline.

So, I disabled email service for the domain ( and spam and virus scanning), and then tried to resend the email. Now I get ‘Relay access denied (in reply to RCPT TO command)’.

There must be a way to separate the email from the website, so that other domains on the same server can send emails to that domain.

Yeah, you should be able to use a third party for email – several folks on a server I have here use Gmail for email even through the website is on the server.

If that much isn’t working, something got goofed up along the way :slight_smile:

Some things I’d check –

  1. Make sure the MX records on your server are active. That is, it’s not enough to set the MX records in Virtualmin, you also have to “Apply” them (which essentially restarts BIND).

  2. Make sure that this domain doesn’t show up in /etc/postfix/virtual. It’s possible some stray lines remaining in there are making Postfix think it needs to deliver those messages locally.

  3. Make sure the domain isn’t listed on the mydestination line of /etc/postfix/

Ok, someone just pointed out to me that the relay denied is coming from our secondary mail server, which is sync’d by virtualmin, and is kept in sync whenever a change is made (at least the virtualmin progress messages say as much). Why would any email be going out through the secondary email server? We have not pointed any MXrecords (except for the domain I am sending my email from, which is our company email, for testing purposes) at the secondary email server yet, it is on the ‘to do’ list, as soon as we know that it is working correctly.

Does virtualmin send anything out through the secondary email server? It must, if relay denied messages are originating from it. very confusing…

I deleted the DNS records for the domains that use a premium mail service like myoutlookonline, using the virtualmin interface. Did this effect Virtualmin in any way?


To clarify, Virtualmin isn’t sending the mail – it simply sets up Postfix such that Postfix can send out emails on behalf of your users.

By default, it would be talking directly to the remote mail server, and I can’t really say why your secondary servers are getting involved.

A message should only end up there if someone tries to mail you, and it’s unable to see your primary server.

As far as deleting the DNS records for Virtual Servers that use a premium service – you may want to actually disable the DNS service altogether so your server doesn’t look like it provides DNS for your domain.

That is, even without DNS records, if your DNS server has a zone setup for your domain, it looks like it’s supposed to have DNS records. And oddness could occur :slight_smile:

So, I’d make sure you’ve gone into Edit Virtual Server for the domains in question, and disable the “DNS Domain Enabled” feature if DNS is being hosted elsewhere.


Yes, I disabled the DNS service using the Virtualmin interface, and I disabled email, spam, and antivirus for the domain, as they are not needed. What I did:

Edit Virtual Server>Enabled features


Mail for domain enabled?

Virus filtering enabled?

DNS domain enabled?

Spam filtering enabled?

I can now send mail from an account on my server to the premium mail service, without generating a bounce message from my server. I do not know why the secondary mail server was involved at all, which is why I asked if the virtualmin setup of the secondary mail server might have had an unintended side effect. I changed the MX record for the domain I was sending the email from, so that the secondary mail server was not listed as secondary MX record. I will reenable that in the near future, on one domain only (mine), to test if the secondary mail server is ready for prime time.

Thanks again for your help, and prompt responses.