> 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/integrations/guides/cpanel.md).

# cPanel SMTP Relay

Configure Mailtrap Email Live Sending as an SMTP relay (Smarthost) in cPanel using Exim mail server configuration.

You can use Mailtrap Email Live 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
