sending email for the domain to another server

Hi, one of the domains I am hosting on VM needs to have all email delivered to an external exchange server. I am generating emails for the domain in questions via an application on the VM box, but those emails are being trapped by VM and not relaying out to the exchange server.

What is the easiest way for me to have those emails relay out?

Thank you

Status: 
Active

Comments

Howdy -- if the "Mail for Domain" feature is enabled in Edit Virtual Server -> Enabled Features, that tells Postfix to deliver all email for that domain locally.

Does the MX record for that domain point to your Exchange server? If so, unchecking the Mail for Domain feature should allow those emails to get to your Exchange server.

got the following error when trying to uncheck "mail for domain"

Error
Failed to modify server : Virus filtering cannot be enabled unless email and spam filtering is

and yes the mx for that domain points to an external exchange server. so emails to that domain work fine except those that originate on the virtualmin server. i want the VM server to be able to send emails to that domain thanks

It's saying that, in order to disable the "Mail for Domain" feature, that the "Virus Scanning" feature also needs to be disabled.

Disable that Virus Scanning feature, and then try it again.

I have disabled spam, AV and mainman but I cannot uncheck "mail for domain" error is:

Error
Failed to modify server : A target server must have email enabled if any aliases do

It sounds like you're working with a Virtual Server that has one or more alias servers.

That error is explaining that you'd need to first disable the Mail for Domain feature in the alias, before you can disable Mail for Domain in the current Virtual Server.

yes, that was it. thank you

ok, so I was finally able to uncheck "Mail for Domain" feature after following the advice above. The email still gets trapped by the VM. What log can I check to trace the email going out? thanks

Hmm, disabling the Mail for Domain feature is typically all that's required to resolve that.

One thing to check for is to verify that there isn't still an entry remaining in the Postfix config for that particular domain.

To do that, log into your server as root over SSH, and run this command:

grep domain.tld /etc/postfix/virtual

Where "domain.tld" is the name of the domain you're attempting to host on the Exchange server.

When you run that command, does it show any output?

see next response

Well, nuts, those shouldn't be in there :-)

Just to be super-sure -- can you take a look in Edit Virtual Server -> Enabled Features, and verify that Mail for Domain is still listed as being disabled?

If it is -- you may have run into a bug that we should get Jamie to take a look at.

We can get that manually fixed up quickly, but Jamie may need to look first in order to figure out how to prevent that from happening in the future.

here is what i have. i have not restarted any services since unchecking all of these things.

please let me know what i need to do to clean this up in the meantime so i can get emails flowing from my apps to the users on this domain

thank you!

I will be happy to work with Jamie to help recreate this bug.

Thanks for all your help, and we're sorry that you're running into problems with email.

I sent Jamie a notice regarding this, so we'll see what he has to say. We'll have your system fixed up soon!

Okay, we're discussing a more intuitive long-term fix for this issue.

However, in the meantime -- to get this issue corrected, what you'll need to do is:

  • Re-enable the Mail for Domain feature

  • Go into System Settings -> Virtualmin Configuration -> Advanced Options, and set "Delete all email aliases when disabling mail" to "yes".

  • Un-check the Mail for Domain feature

After doing that -- those entries in your virtual file should be removed as expected.

ok that worked, and the entries are now gone. However, email is still not being received on the users external server. What log can I look at to troubleshoot the outbound email for this domain, and where how can I view the catchall mailbox to see what emails have already been piling up on the server?

thank you

On CentOS -- you can view the mail logs in /var/log/maillog.

Those will show any incoming and outgoing emails, as well as any errors that come up during the delivery process.

There aren't any catchall addresses setup by default in Virtualmin -- but those can be manually added.

If you did add a catchall, you would have had to associate it with a particular email account. So, to view any email the catchall address received, you would need to view the email for that specific account.

There's a few ways to do that -- one of which is to log into that user on Usermin on port 20000.

Ah, so here's the problem from /var/log/maillog

Nov 2 15:34:02 kickback postfix/smtp[6380]: connect to pickettspress.com[69.160.251.229]: Connection timed out (port 25) Nov 2 15:34:02 kickback postfix/smtp[6380]: 1B6EF4A6E90: to=info@pickettspress.com, relay=none, delay=1139, delays=1119/0.03/21/0, dsn=4.4.1, status=deferred (connect to pickettspress.com[69.160.251.229]: Connection tim ed out)

postfix is still trying to deliver to the local server and not via the MX records for the hosted domain.

by the way, certain character in the above are not showing between the greater than and less than symbols.

It sounds like you're saying the domain you're having problems with is pickettspress.com. When reviewing the whois records for that domain, it looks like the nameservers for that server are set as NS29.WORLDNIC.COM and NS30.WORLDNIC.COM.

It looks like the MX records for that domain are pointing to Google (Gmail).

However, I believe those "worldnic.com" nameservers belong to a third party, and aren't nameservers running on your own Virtualmin server.

If your DNS is being hosted by a third party, you'd need to go into Edit Virtual Server -> Enabled Features, and disable the "BIND DNS Domain" feature.

Otherwise, your server will think it has authoritative DNS data on it's server -- and that data may differ from what you intended, causing the problems you're seeing.

after dns was disabled, the mail is now flowing to the external mail server.

so in the future, what exactly needs to be done? Since this is a common scenario for us. DNS and email will usually be hosted by exchange or google and there will be a separate dns server hosting the records for the domain? can we just disable dns or does "email for domain" also need to be disabled?

thanks for the support

so in the future, what exactly needs to be done

If email is being hosted on a different server, you'd want to disable the "Mail for Domain" feature (and then, any "Mail" dependencies such as the Spam and Virus scanning features).

If DNS is being hosted on a different server, you'd want to disable the "BIND DNS Domain" feature.

That's all you should have to do! Everything else should be in good shape.

Thanks, case closed.