Introduction
Many providers now block outbound connections on port 25, meaning a cPanel system would need to configure a smart host to allow outbound emails to function. This resource covers how to set up 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.
Procedure
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:
- Sign up for MailGun, if you still need to do so.
- 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:
mailgun_login:
NOTE: The Default-SMTP-Login and Default-Password are found in your MailGun account in the Domain Settings section.
driver = plaintext
public_name = LOGIN
hide client_send = : Default-SMTP-Login:Default-Password - Next, go to the "Section: ROUTERSTART" and input the following:
- On v108 or above
mailgun:
driver = manualroute
domains = ! +local_domains : ! +manualmx_domains
.ifdef SRSENABLED
# if outbound, and forwarding has been done, use an alternate transport
transport = ${if eq {$local_part@$domain} \
{$original_local_part@$original_domain} \
{mailgun_transport} {mailgun_forwarded_transport}}
.else
transport = mailgun_transport
.endif
route_list = "* smtp.mailgun.org::587 byname"
host_find_failed = defer
no_more - On v106 or below
mailgun:
driver = manualroute
domains = ! +local_domains : ! +manualmx_domains
transport = mailgun_transport
route_list = "* smtp.mailgun.org::587 byname"
host_find_failed = defer
no_more
- On v108 or above
- Then go to "Section: TRANSPORTSTART." Input the following into the text box:
mailgun_transport:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org - On v108 or above, additionally, add the following to the "TRANSPORTSTART" section:
.ifdef SRSENABLED
mailgun_forwarded_transport:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org
max_rcpt = 1
return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
.endif - 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.
- 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.
Notes:
- 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 smart host 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 smart host; the server's system administrator must configure this.
Comments
0 comments
Article is closed for comments.