Delivery mails to external MX (Google) with the same domain

I have a new instance with HestiaCP (Exim4) and I try to configure the email service with HestiaCP and Google Workspace

I have already configured the rules so that all the sendings are made to Google and Google is in charge of routing the email service

All emails I send to my domain from accounts on the HestiaCP server are delivered OK to Google and HestiaCP

However, the emails that I send from [email protected] (account that exists in HestiaCP) to a Google account, for example [email protected], are discarded, since the email account is not found within the Exim map

How can I make Exim4 try to deliver outgoing mail to the MX published on the internet and not try to do it directly on the local server?

HestiaCP account:

exim -bt [email protected]
[email protected]
router = localuser, transport = dovecot_virtual_delivery

Google Account

exim -bt [email protected]
[email protected] is undeliverable: Unrouteable address

I need all outgoing shipments from my domain to try to deliver first to the MX published on the internet and not locally (I have the same domain on Google and on my HestiaCP server)

What configuration file in Exim should I edit and with what conditions?

Thank you.

Disable local delivery

Hello Eris

How to I Can disable the local delivery?

This will not give problems when Google Workspace tries to deliver mail to the mailboxes created in hestiaCP?

Thank you.

Disable local email for that domain and use gmail

Hello @jlguerrero

I need to use the mail service in parallel on both sides

I have some accounts in Google Workspace and other accounts in HestiaCP, so your suggestion is not valid for my case.

Then you still want to disable local delivery for the domain. How ever never done it in exim…

Hello, I wish I could deliver emails on the HestiaCP server and on Google Workspace

Example:

In HestiaCP - Group 1 in Google
[email protected]
[email protected]
[email protected]

In Google Workspace - Group 2 in GOogle
[email protected]
[email protected]
[email protected]

Google Workspace will be in charge of making the deliveries according to the routing that I indicate through User Groups

I need all mail users to be able to send messages to each other, also incoming mail from the internet

You cant use two different servers for incoming mails, that’s not how mx records are designed. You can overwrite the handling of outgoing mails in exim configuration to skip local delivery part, but I dont think this will solve your issue.

You need to decide to use either google or hestia for your mails.

Thanks for your reply

The solution I had was to change the mail provider to iRedMail and manually configure the Realy of the mail service to be able to deliver some mailboxes in Google Workspace and others in my local server simultaneously.

Since hestiaCP doesn’t allow doing it and exim doesn’t seem to either.