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

# Emails

> How to configure outgoing email for ChatbotX.

ChatbotX sends transactional emails using **Nodemailer** over SMTP. Emails are triggered for the following events:

* Sign-up email verification
* Sign-in magic link
* Password reset

<Note>
  Email sending is required for authentication flows. Users will not be able to verify their account or use magic link login until a working SMTP connection is configured.
</Note>

***

## Environment variables

Two variables control email delivery:

### `SMTP_SERVER`

```bash theme={null}
SMTP_SERVER=smtp://username:password@smtp.yourdomain.com:587
```

Nodemailer connection URL. Supports `smtp://` (plain/STARTTLS on port 587) and `smtps://` (implicit TLS on port 465). **Required.**

***

### `NEXT_PUBLIC_SMTP_FROM`

```bash theme={null}
NEXT_PUBLIC_SMTP_FROM=no-reply@yourdomain.com
```

The `From` address shown to recipients for all outgoing emails. **Required.**

***

## Providers

### MailHog (local development)

[MailHog](https://github.com/mailhog/mailhog) is included in the Docker Compose development stack. It catches all outgoing emails and displays them in a web UI — no real delivery occurs.

```bash theme={null}
SMTP_SERVER=smtp://localhost:1025
NEXT_PUBLIC_SMTP_FROM=no-reply@chatbotx.local
```

Open the MailHog web UI at [http://localhost:8025](http://localhost:8025) to inspect sent emails.

***

### Gmail

<Warning>
  Gmail requires an [App Password](https://support.google.com/accounts/answer/185833) — your regular account password will not work. Two-factor authentication must be enabled on the Google account.
</Warning>

1. Go to your Google Account → Security → App passwords
2. Generate a new app password for "Mail"
3. Configure your `.env`:

```bash theme={null}
SMTP_SERVER=smtps://your@gmail.com:app-password@smtp.gmail.com:465
NEXT_PUBLIC_SMTP_FROM=your@gmail.com
```

***

### AWS SES

1. Verify your sending domain or address in the [SES console](https://console.aws.amazon.com/ses)
2. Create SMTP credentials under **SES → SMTP settings → Create SMTP credentials**
3. Configure your `.env`:

```bash theme={null}
SMTP_SERVER=smtps://SMTP_USERNAME:SMTP_PASSWORD@email-smtp.us-east-1.amazonaws.com:465
NEXT_PUBLIC_SMTP_FROM=no-reply@yourdomain.com
```

Replace `us-east-1` with your SES region.

***

### Resend

Resend exposes an SMTP interface compatible with Nodemailer.

1. Sign up at [resend.com](https://resend.com) and verify your sending domain
2. Create an API key
3. Configure your `.env`:

```bash theme={null}
SMTP_SERVER=smtp://resend:your-api-key@smtp.resend.com:587
NEXT_PUBLIC_SMTP_FROM=no-reply@yourdomain.com
```

***

### Mailgun

1. Add and verify your domain in the [Mailgun dashboard](https://app.mailgun.com)
2. Go to **Sending → Domain settings → SMTP credentials**
3. Configure your `.env`:

```bash theme={null}
SMTP_SERVER=smtps://postmaster@yourdomain.com:your-password@smtp.mailgun.org:465
NEXT_PUBLIC_SMTP_FROM=no-reply@yourdomain.com
```

***

### Postmark

1. Create a [Sender Signature](https://account.postmarkapp.com/signatures) for your `From` address
2. Find your SMTP credentials in the server settings
3. Configure your `.env`:

```bash theme={null}
SMTP_SERVER=smtps://your-server-token:your-server-token@smtp.postmarkapp.com:465
NEXT_PUBLIC_SMTP_FROM=no-reply@yourdomain.com
```

***

### Generic SMTP

For any other provider, use the standard Nodemailer URL format:

<CodeGroup>
  ```bash STARTTLS (port 587) theme={null}
  SMTP_SERVER=smtp://username:password@smtp.yourdomain.com:587
  ```

  ```bash Implicit TLS (port 465) theme={null}
  SMTP_SERVER=smtps://username:password@smtp.yourdomain.com:465
  ```

  ```bash No auth theme={null}
  SMTP_SERVER=smtp://smtp.yourdomain.com:25
  ```
</CodeGroup>

<Tip>
  See the [Nodemailer SMTP transport docs](https://nodemailer.com/smtp/) for the full URL format and all supported options.
</Tip>
