Many providers now block outbound connections on port 25, which means that a cPanel system would need to configure a smarthost to allow for outbound emails to function. This resource covers how to setup a smarthost using a common 3rd-party mail provider, MailGun.
MailGun has numerous plans, including a pay-as-you-go plan. Their free tier offers 10,000 emails, 100 email validations, and 5-day log-retention.
The MailGun smarthost setup instructions are similar to the SendGrid smarthost setup instructions. The main difference with MailGun is that it uses "ROUTERSTART" instead of "PREROUTERS".
To configure MailGun on your server:
1. Sign up for MailGun here, if you have not already done so.
2. Log in to WHM, and navigate to WHM > Service Configuration > Exim Configuration Manager > Advanced Editor. On this page, search for "Section: AUTH". In the text box, input the following:
driver = plaintext
public_name = LOGIN
hide client_send = : Default-SMTP-Login:Default-Password
The Default-SMTP-Login and Default-Password are found in your MailGun account in the Domain Settings section.
3. Next, go to the "Section: ROUTERSTART" section, and input the following:
driver = manualroute
domains = ! +local_domains
transport = mailgun_transport
route_list = "* smtp.mailgun.org::587 byname"
host_find_failed = defer
4. Then go to the "Section: TRANSPORTSTART" section. Input the following into the text box:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org
5. Go to the bottom of the page and click, "Save". The changes will get added to the Exim configuration and will automatically restart the Exim service.
6. Try sending a test email using one of the Webmail applications. If the email does not leave the server, you must examine the
/var/log/exim_mainlog file to determine the cause of the issue.
- This guide is a task intended for system administrators. cPanel's Technical Analysts cannot provide assistance in configuring a server's smarthost setup.
- Configuring a smarthost will cause all outbound emails to go through the configured provider. The scope of this document does not cover how to configure a subset of domains to go through a smarthost; this must be configured by the system administrator of the server.
- A similar resource for setting up a smarthost with SendGrid is here.