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

# Sendmail

> Configure Sendmail mail server to use JetEmail as a smarthost

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

## Prerequisites

* Root access to your server
* Sendmail 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 Sendmail configuration file (typically `/etc/mail/sendmail.mc`):

    ```m4 theme={null}
    # JetEmail Authentication
    define(`SMART_HOST', `relay.jetsmtp.net')
    define(`RELAY_MAILER_ARGS', `TCP $h 25')
    define(`confAUTH_MECHANISMS', `LOGIN PLAIN')
    define(`confDEF_AUTH_INFO', `your_username:your_password')
    ```

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

  <Step title="Configure DKIM Support">
    Add DKIM configuration for email authentication:

    ```m4 theme={null}
    # DKIM Configuration
    define(`confDKIM_SIGNING_KEY', `/path/to/dkim/private/${domain}')
    define(`confDKIM_SELECTOR', `default')
    define(`confDKIM_DOMAIN', `${domain}')
    ```

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

    <Note>
      DKIM configuration is only needed if you haven't configured the domain in the JetEmail dashboard. If you've already set up DKIM in the dashboard, you can skip this step.
    </Note>
  </Step>

  <Step title="Configure Access Control">
    Add access control to allow authentication:

    ```m4 theme={null}
    # Access Control
    FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')
    FEATURE(`relay_entire_domain')
    FEATURE(`relay_hosts_only')
    FEATURE(`relay_based_on_MX')
    ```

    Create or update `/etc/mail/access`:

    ```plaintext theme={null}
    relay.jetsmtp.net RELAY
    your_domain.com RELAY
    ```
  </Step>

  <Step title="Configure Mailer">
    Add the SMTP mailer configuration:

    ```m4 theme={null}
    # SMTP Mailer Configuration
    MAILER(`smtp')
    MAILER(`local')
    ```

    <Note>
      The `MAILER` definitions should be at the end of your sendmail.mc file.
    </Note>
  </Step>

  <Step title="Generate Configuration and Restart">
    Generate the Sendmail configuration and restart the service:

    ```bash theme={null}
    # Generate sendmail.cf from sendmail.mc
    m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

    # Test configuration syntax
    sendmail -bt -C /etc/mail/sendmail.cf

    # Restart Sendmail
    systemctl restart sendmail  # Systemd
    # OR
    service sendmail restart    # SysV init
    ```
  </Step>
</Steps>

## Alternative Configuration Method

If you prefer to edit the `sendmail.cf` file directly, add these lines:

```plaintext theme={null}
# JetEmail SMTP Configuration
DSrelay.jetsmtp.net
# Authentication
DAyour_username:your_password

```

## Testing Your Configuration

After configuration, test your setup:

1. Send a test email to an external address:
   ```bash theme={null}
   echo "Test message" | mail -s "Test Subject" test@example.com
   ```

2. Check email headers for authentication details:
   ```bash theme={null}
   sendmail -bv test@example.com
   ```

3. Monitor delivery in your JetEmail dashboard

## Troubleshooting

### Authentication Failures

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

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

### Configuration Errors

* Check Sendmail logs for error messages:
  ```bash theme={null}
  tail -f /var/log/maillog
  ```
* Verify configuration syntax:
  ```bash theme={null}
  sendmail -bt -C /etc/mail/sendmail.cf
  ```
* Check for syntax errors in sendmail.mc:
  ```bash theme={null}
  m4 /etc/mail/sendmail.mc > /dev/null
  ```

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