Help setting up email relay

maverickws

Member
Dec 13, 2017
14
2
3
Lisbon
cPanel Access Level
Root Administrator
Hi all,

I'm not super with email administration so I kind of need some help with the following situation:

Our cpanel/whm servers are within domainabc.com. So we have server1.domainabc.com, server2.domainabc.com etc.
The account domainabc.com is not hosted on any cpanel server, nor the DNS or email server.

We need that emails sent by these servers (from [email protected]) get relayed through our mail server. This is only for the messages from cpanel itself, not the messages from user accounts.
We found this article How to Set Up a Smarthost SMTP Relay with cPanel | cPanel Blog but I'm unsure if this will apply to all the messages (including from user accounts) or only cpanel messages.

What is the correct approach to achieve the desired outcome? Thank you!
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
Hey there! If you setup a Smarthost, all the traffic would use that. Server notifications do use the Exim mailer, just like regular emails.

Here's an example of a root login notification from CSF and the log it leaves in /var/log/exim_mainlog:

Code:
2021-06-21 08:54:56 1lvJS4-0007vu-LE <= [email protected] U=root P=local S=598 T="lfd on host.domain.com: WHM/cPanel root access alert from 1.2.3.4 (US/United States/hou-2.n" for root
2021-06-21 08:54:56 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1lvJS4-0007vu-LE
2021-06-21 08:54:56 1lvJS4-0007vu-LE Sender identification U=root D=-system- S=root
 

maverickws

Member
Dec 13, 2017
14
2
3
Lisbon
cPanel Access Level
Root Administrator
I'm not looking to send all emails through the relay host, only emails generated by the cpanel host itself.
User accounts and their domains should use the localhost.

From what I've read it seems perfectly possible to achieve this, I'm only unsure about the proper configuration.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
Thanks for the additional details. In the blog you linked, there is an example configuration section which contains this:

Code:
send_via_mySmartHost:
    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp
    route_list = * smtp.example.com::25
the local_domains section will ensure that local domains do not route through the smarthost. For example, if domain1.com sends a message to domain2.com, that will stay local to the system. If domain1.com sends a message to Gmail, that would go through the smarthost.

For more advanced configurations, you may need to dig in to the Exim documentation or work with an admin, as cPanel doesn't provide support for the actual smarthost configuration.
 

maverickws

Member
Dec 13, 2017
14
2
3
Lisbon
cPanel Access Level
Root Administrator
thank you for your reply, I saw that example config but that is not what I am looking for.
Picking on the example you provided, if domain1.com sends an email to gmail, I don't want the message to be sent through the smarthost.
Only messages generated by the cpanel software, that are sent usually from [email protected] are to be sent via smarthost.

The cpanel fqdn belongs to a domain which is not hosted on any cpanel server. We have our own DNS system, email servers, web servers. etc.
Emails sent from the cPanel server will use our domain on from, but we don't want system emails to be sent directly from the cpanel server, but relayed through our email server, authenticated.

The authentication part is covered in this part of the blog post:
Code:
mySmartHost_login:
    driver = plaintext
    public_name = LOGIN
    client_send = : Username : Password
But only emails from cpanel system are to be sent via smarthost.

Customer account emails, whatever the domain, are to be handled by the cpanel server directly.
 

maverickws

Member
Dec 13, 2017
14
2
3
Lisbon
cPanel Access Level
Root Administrator
Thank you for your feedback and patience! I have opened a ticket id #94338527, I think my question wasn't clearly understood at first, but looking forward for the reply.
From what I was able to search around on the web I think it is doable, but email administration is not my thing and I'm worried that I may disrupt our customer's emails, that's why I'm looking for a clear understanding of the issue and a configuration that matches our desired behaviour before making any changes.