> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/guides/integrations/cpanel.md).

# 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**.

{% code title="/etc/exim.conf - Authentication" %}

```
mailtrap_login:
driver = plaintext
public_name = LOGIN
client_send = : username : password
```

{% endcode %}

### 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.

{% code title="/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
```

{% endcode %}

### Step 3: Transport configuration

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

{% code title="/etc/exim.conf - Transport" %}

```
mailtrap_smtp:
driver = smtp
hosts = live.smtp.mailtrap.io
hosts_require_auth = $host_address
hosts_require_tls = $host_address
```

{% endcode %}

## Apply changes

Restart the Exim service with the following command:

```bash
$ systemctl restart exim
```

Mailtrap will now be used as your cPanel Smarthost.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mailtrap.io/guides/integrations/cpanel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
