Different outgoing and incoming email servers

Operating System & Version
CLOUDLINUX 7.9
cPanel & WHM Version
v94.0.10

gmusgrave

Registered
Jul 5, 2021
2
0
1
Chapala, Mexico
cPanel Access Level
Reseller Owner
I would like all email accounts on a server to continue using the standard mail server for all incoming emails (e.g.: mail.domain.com). However, I would like forwarded emails to use an external mail server for the outgoing emails.

In other words, [email protected] would receive an email via the standard email server, but if it is set to forward this email to three recipients, then these three emails would be sent by an external mail server.

Is this possible to do with DNS?

Thanks.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
Hey there! I don't believe this is possible due to how email works.

In general, email is routed to the correct mail server based on the MX record. So no matter if the message is sent directly, or is forwarded, it's going to get delivered to the same mail host. DNS has no concept of mail forwarding, as it just routes the domain name itself to the correct server.

The only other option I can think of would be some additional custom filtering of the message on the server-side to send it to a folder or deliver it to a certain address.
 

gmusgrave

Registered
Jul 5, 2021
2
0
1
Chapala, Mexico
cPanel Access Level
Reseller Owner
Yes, that is true for email sent to an email account on our server, and we want this to continue this way.

However emails forwarded by cPanel, and not someone sending us an email, are sent out using the local email server.

In other words, when you tell cPanel to forward emails addressed to a particular cPanel email account to one or more other email accounts (often on different servers), cPanel will receive an email destined for the account to be forwarded (using the local incoming server), and cPanel will then forward it to the other email addresses that you have configured. This outgoing mail server used by cPanel to send these forwarded emails is the one we want to change to an external email service.

Hopefully, this is clearer.

Thanks.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
Thanks for that clarification - that does indeed make more sense.

I don't have anything built-in to the product that would handle this, but it may be doable with customizations. The closest thing I could offer would be using a SmartHost with selected domains as outlined here:


which is a configuration that allows some domains to send through Exim and some domains to send through a SmartHost. You may be able to further customize that to just handle forwarded messages, but that isn't something I've come across and I didn't find much in my search.