2 Email provider for single domain PLease help

Hi everyone,

I’m currently setting up email services for my domain using Virtualmin and need some assistance. My goal is to configure two separate email providers for my domain, with some users on Virtualmin and others on Google Workspace. Here’s a brief overview of what I’m aiming to achieve:

What is the best approach to configure Virtualmin and Google Workspace for different users on a single domain?
How should I set up my DNS records (MX, SPF, DKIM, DMARC) to ensure proper routing and security?
Are there any specific considerations or best practices I should follow to avoid conflicts between the two providers?

Any help or guidance would be greatly appreciated. Thank you!

You kinda can’t do that. I mean, you could have multiple MX records, but only one will be used in any given interaction, so mail would randomly be sent to the wrong server half the time.

You have some options, though.

If you don’t need them to be on the same name, you can easily split them up. e.g. Some users are on extra.domain.tld and others are on domain.tld and you have some users with the email address user@extra.domain.tld and some with an email address of user@domain.tld.

If you can’t do that, one of these servers is going to need to forward to the other. I don’t think you have good control over that kind of behavior in Google Workspace, so think you’ll need to make the Virtualmin server the mail server, and configure it to forward mail for those Google users to Google, probably using transport maps (but forwarding via other methods could also work).

I think if I were you I’d figure out a way to make everybody happy with one or the other and not do this complicated stuff. It’s going to be messy, if you’re not super comfortable with how mail relaying works and managing MX records and such. (Even if you are, it’s going to take a lot of fiddling.)


Hi Joe,

Thank you so much for your help.
I can forward emai from google workspace to virtualmin.

but when i sending email from virtualmin server to gsuit users virtualmin server says:-
user not in local alies tabel .
i think its only check the user localy.
how i can configure virtualmin to send the email if the user is not found localy so it can hit the google workspace mx record .

Thank you again for you help.

error:- Recipient address rejected: User unknown in local recipient table

That probably means one of two things. You either don’t have that user in the virtual map (did you create the user in Virtualmin?), or something is wrong with mydestination or myhostname or … something along those lines. Did you modify either of those?

You can’t. That’s not how it works. As I said above, you need to explicitly forward using maybe a transport map or something along those lines. I’ve never tried to build a split mail server exactly like this before. Though I have occasionally setup aliases that forward to some GMail address, that’s not the same problem you have.

I mean, I guess you could build a policy server to make those kinds of decisions, maybe? But, Postfix doesn’t have an “if user doesn’t exist, do this other thing” logic, as far as I know. That’s a rejection. It needs to match something. I’m not sure if policy servers can make transport decisions, though…seems likely.

But, you need to start by reading up on transport maps: Postfix manual - transport(5)

We have been doing this sort of thing in India for ages, mostly to enable clients to save on cost of Google / Microsoft mailboxes. See Hybrid Email Hosting .

But Joe is right, it is messy. Unless you have a small number of Google / Microsoft mailboxes and a very large number of Virtualmin mailboxes - and I mean in the hundreds, the cost savings are not worth the hassle.

1 Like

You can use gmail/workspace routing. However, you would have to make gmail your default MX.