> ## Documentation Index
> Fetch the complete documentation index at: https://jetemail.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Exim

> Configure Exim mail server to use JetEmail as a smarthost

This guide will walk you through configuring Exim to use JetEmail as your smarthost for improved email deliverability and authentication.

## Prerequisites

* Root access to your server
* Exim mail server installed and running
* JetEmail SMTP credentials from your [dashboard](/outbound/getting-started)

## Configuration Steps

<Steps>
  <Step title="Generate SMTP Credentials">
    Create a smarthost (or use an existing one) in your JetEmail [dashboard](/outbound/getting-started).
  </Step>

  <Step title="Configure Authentication">
    Add the following to your Exim configuration file (typically `/etc/exim4/exim4.conf.template` or `/etc/exim.conf`):

    ```plaintext theme={null}
    # JetEmail Authentication
    jetemail_login:
      driver = plaintext
      public_name = LOGIN
      client_send = : your_username : your_password
    ```

    Replace `your_username` and `your_password` with your JetEmail SMTP credentials.
  </Step>

  <Step title="Configure Transport">
    Add the transport configuration:

    ```plaintext theme={null}
    # JetEmail SMTP Transport
    jetemail_smtp:
      driver = smtp
      hosts_require_auth = *
      tls_tempfail_tryclear = true
      headers_add = X-AuthUser: your_username
      hosts_try_chunking =
      hosts_try_fastopen =
      dkim_domain = ${lc:${domain:$h_from:}}
      dkim_selector = default
      dkim_private_key = /path/to/dkim/private/${dkim_domain}
    ```

    <Note>
      Update the `dkim_private_key` path to match your DKIM key location.
    </Note>
  </Step>

  <Step title="Configure Router">
    Add the router configuration to send mail via JetEmail:

    ```plaintext theme={null}
    # JetEmail Smarthost Router
    send_via_jetemail:
      driver = manualroute
      domains = ! +local_domains
      ignore_target_hosts = 127.0.0.0/8
      transport = jetemail_smtp
      route_list = * relay.jetsmtp.net::25 randomize byname
      no_more
    ```
  </Step>

  <Step title="Optional: Configure SRS (Sender Rewriting Scheme)">
    For email forwarding scenarios, add SRS support:

    ```plaintext theme={null}
    # SRS Transport for forwarded emails
    jetemail_forward_smtp:
      driver = smtp
      hosts_require_auth = *
      tls_tempfail_tryclear = true
      headers_add = X-AuthUser: your_username
      hosts_try_chunking =
      hosts_try_fastopen =
      dkim_domain = ${lc:${domain:$h_from:}}
      dkim_selector = default
      dkim_private_key = /path/to/dkim/private/${dkim_domain}
      return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
      max_rcpt = 1
    ```
  </Step>

  <Step title="Test and Restart Exim">
    Test your configuration and restart Exim:

    ```bash theme={null}
    exim -bV  # Test configuration syntax
    systemctl restart exim4  # Debian/Ubuntu
    # OR
    systemctl restart exim   # CentOS/RHEL
    ```
  </Step>
</Steps>

## Additional Configuration

### SPF Records

Don't forget to update your SPF records to include JetEmail's servers:

```
v=spf1 include:spf.jetsmtp.net ~all
```

Learn more about [email authentication](/outbound/email-authentication).

### Domain Authentication

For enhanced security and deliverability:

* Configure [Domain Lockdown](/outbound/domain-lockdown) to prevent domain spoofing
* Set up [DMARC](/outbound/dmarc) for email authentication
* Ensure proper DKIM signing is configured

## Testing Your Configuration

After configuration, test your setup:

1. Send a test email to an external address
2. Check email headers for authentication details:
   ```bash theme={null}
   echo "Test message" | mail -s "Test Subject" test@example.com
   ```
3. Monitor delivery in your JetEmail dashboard
4. Verify SPF, DKIM, and DMARC alignment

## Troubleshooting

### Authentication Failures

* Verify your SMTP credentials are correct
* Ensure your account is active and in good standing
* Check that authentication headers are properly configured

### Connection Issues

* Verify ports 25 or 587 are open in your firewall
* Test connectivity to `relay.jetsmtp.net`:
  ```bash theme={null}
  telnet relay.jetsmtp.net 25
  ```
* Check TLS configuration

### Configuration Errors

* Check Exim logs for error messages:
  ```bash theme={null}
  tail -f /var/log/exim4/mainlog  # Debian/Ubuntu
  tail -f /var/log/exim/main.log  # CentOS/RHEL
  ```
* Verify configuration syntax with `exim -bV`

## Control Panel Integration

If you're using a control panel, consider using our automated solutions instead:

* [cPanel Integration](/outbound/control-panels/cpanel) with automated plugin
* [DirectAdmin Integration](/outbound/control-panels/directadmin)
* [Webuzo Integration](/outbound/control-panels/webuzo)

For additional support, contact our team or visit our [Discord community](https://jetemail.com/discord).
