Configure Mailgun on cPanel (Exim)
Configure Mailgun on cPanel is quite a simple task. Mailgun is an email automation service provided by Rackspace. It offers a complete cloud-based email service for sending, receiving and tracking email sent through your websites and applications.
Mailgun features are available through an intuitive RESTful API or using traditional email protocols like SMTP. It will help you to avoid the situation of detecting your email as spam in main email service providers.
This post will help you to configure Mailgun on cPanel. You can simply do it using “Exim Configuration Manager” option available on WHM. Please go to WHM > Service Configuration > Exim Configuration Manager and open the “Advanced Editor” tab.
You need to edit following sections there:
Search for “Section: AUTH” and add the following.
mailgun_login: driver = plaintext public_name = LOGIN hide client_send = : mail@yourdomain.com : Password
Change mail@yourdomain.com with your “Default SMTP Login” and Password with “Default Password”
Then, search for “Section: PREROUTERS” and add the following code.
mailgun: driver = manualroute domains = ! +local_domains transport = mailgun_transport route_list = * smtp.mailgun.org byname
Lastly, search for “Section: TRANSPORTSTART” and add the following code.
mailgun_transport: driver=smtp hosts_try_auth = smtp.mailgun.org
Save the configuration and send a test email. You can find something with *mailgun.info in the email header. Also, please note that, as this is a server wide configuration, the emails of all users on the server will relay through Mailgun.
Rackspace Cloud customers can send 50,000 emails per month for free with Mailgun’s basic plan. Mailgun is capable of integrating with postfix service, sending email through SMTP.
That’s it! Please let us know if you have any questions.
If you like this post and wish to receive more articles from us, please like our FB page: Grepitout
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.
For more details on our services, please drop us an E-mail at info@grepitout.com
Remember that for those who use Google Cloud, port 25, exim default is blocked. So the suggestion is to use port 2525.
Your route list would look like this: route_list = * smtp.mailgun.org::2525 byname
Thanks for the info 🙂
Hi there
The problem is that Mailgun requires a user/password by domain. It does not accept cross domains so each message should require the credentials based on the sender’s domain
Thanks
Thanks. Only change is I had to use:
`hosts_require_auth = smtp.mailgun.org` instead of `hosts_try_auth = smtp.mailgun.org` under Section: TRANSPORTSTART
If you need to setup different mailgun or other SMTP credentials for multiple cPanel domains use this instruction set!
https://forums.cpanel.net/threads/how-to-send-email-from-different-domains-using-different-smarthosts.641949/