How to send/receive mail using another virtualmin server?

I have set up virtualmin (latest version) on two separate servers (both Ubuntu 18.04) with the intention of separating the webserver from the mailserver.

Do I need to fiddle with the postfix/dovecot files or is there an inbuilt feature that tells a virtualmin webserver to send/receive mail from an external virtualmin mailserver?

Regards

Good that you have decided to separate mail from web. Doing so improves web server performance - particularly for parameters such as TTFB and FCP which have become meaningful signals for SEO. I am using it as a sales & marketing feature for my web hosting services - see Fast web servers - dare to compare TTFB and FCP. This is one way Virtualmin trumps cPanel and others, which force mail + web on the same server.

You do not need to edit the config files directly. Here is how you can configure two servers to work in tandem via the options that Virtualmin offes:

  1. In your Virtualmin web optimized server, at the time of creating virtual server for, say, domain.tld, you need just uncheck the box captioned “Accept mail for domain?”. In your Virtualmin mail optimized server, at the time of creating virtual server for domain.tld, you need to uncheck the box captioned “Enable Nginx website?” and “Enable Nginx SSL website?”.

  2. On your Virtualmin web optimized server, in Virtualmin → Server Configuration → DNS Records, edit the MX to point to the MX of your Virtualmin mail optimized server.

Point domain.tld to DNS of the Virtualmin web optimized server.

You can now host your website on your Virtualmin web optimized server and create users / mailboxes on Virtualmin mail optimized server. It should all work except for Usermin, which you will have to abandon for Roundcube or similar.

Sending email to smarthost / relay can be done via Webmin → Postfix → SMTP Authentication And Encryption, “Send outgoing mail via host”. Also see Free smarthost / mail relay to work around port 25 block by VPS host

Hello @calport, hope you’re doing well.

  • With regards to point 2, in Virtualmin -> Server Configuration -> DNS Records, I have added the mx record in the Mail server hostname section and added a priority of 5. What should I add in the Record name section however?

  • In Webmin -> Postfix -> SMTP Authentication And Encryption, should I add the MX record again in the Send outgoing mail via host section or?

Yes, as well as can be expected, under the circumstances. :crossed_fingers:

Record name would be “Same as domain”. I had mentioned in my original message that you edit (rather than add) the MX record… that might have been simpler.

Well, no. This is a one time setting which applies to your entire system. Configuring this will send all email leaving your system via a relay / smarthost. In Webmin → Postfix → SMTP Authentication And Encryption, you need to add the credentials of an account you have on a smarthost / relay, assuming that you do have such an account.

In summary, points 1 and 2 in my original message relate to configuring a new virtual server / domain and the last paragraph in my original message relates to a one-time configuration to define an external smarthost / relay which will be used to send out your messages.

Hope this is all clear now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.