cPanel SMTP Relay

You can use Mailtrap Email Sending as an SMTP relay (Smarthost) in cPanel.

Prerequisites

  1. In your Mailtrap account, go to Sending Domains and click on the verified domain. Then, navigate to the SMTP/API Settings tab.

  2. Locate your /etc/exim.conf file and open it with a text editor. You'll need root access to change the configuration settings for the Exim server.

Configuration

Once the file is open, modify the following code blocks:

Step 1: Authentication mechanism

The first block defines the authentication mechanism. You should change it to include Mailtrap credentials. Substitute username with api and password with your SMTP password.

/etc/exim.conf - Authentication
mailtrap_login:
driver = plaintext
public_name = LOGIN
client_send = : username : password

Step 2: Router configuration

The second block is part of Exim's router section. It configures a route to send all outgoing emails through the Mailtrap SMTP server.

/etc/exim.conf - Router
send_via_mailtrap:
driver = manualroute
domains = ! +local_domains
transport = mailtrap_smtp
route_list = "* live.smtp.mailtrap.io::587 byname"
host_find_failed = defer
no_more

Step 3: Transport configuration

The third block is part of Exim's transport section. It defines Mailtrap transport that will handle email delivery.

Apply changes

Restart the Exim service with the following command:

Mailtrap will now be used as your cPanel Smarthost.

Last updated

Was this helpful?