---
title: "Email"
description: "Set up and configure email notifications for your self-hosted Sentry instance"
url: https://develop.sentry.dev/self-hosted/configuration/email/
---

# Self-Hosted Email

##### Note

After changing configuration files, re-run the `./install.sh` script, to rebuild and restart the containers. See the [configuration section](https://develop.sentry.dev/self-hosted.md#configuration) for more information.

## [Outbound Email](https://develop.sentry.dev/self-hosted/configuration/email.md#outbound-email)

Sentry sends all outbound email over **SMTP**. It does not support provider HTTP APIs (such as the SendGrid, Mailgun, or AWS SES APIs) for sending mail. Every configuration option below is therefore SMTP under the hood — they differ only in what delivers your mail to the internet.

### [Why email matters](https://develop.sentry.dev/self-hosted/configuration/email.md#why-email-matters)

Without a working email configuration, Sentry can't send verification emails. This means:

* Users can't verify their primary email address
* Users can't add secondary or backup emails
* Password reset flows won't work

Email verification confirms that a user owns the address on their account, which protects against unauthorized access. Even if you don't need alert notifications, we recommend configuring email for account security.

## [Get set up](https://develop.sentry.dev/self-hosted/configuration/email.md#get-set-up)

For evaluation, development, or internal/low-volume instances, the built-in SMTP server is the fastest way to get email working with no extra infrastructure.

### [Built-in SMTP server](https://develop.sentry.dev/self-hosted/configuration/email.md#built-in-smtp-server)

This is the default configuration for self-hosted Sentry, powered by [egos-tech/smtp](https://gitlab.com/egos-tech/smtp).

All you need to do is set a valid address for the `mail.from` setting in `config.yml`, and the [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) of your Sentry instance for `SENTRY_MAIL_HOST` in `.env`.

##### Not recommended for production

The built-in server delivers mail directly to recipients. Because it has no established sender reputation and isn't covered by SPF, DKIM, or DMARC records, mailbox providers (like Gmail) will often flag or drop its messages. For production, relay through a dedicated provider instead.

## [Run in production](https://develop.sentry.dev/self-hosted/configuration/email.md#run-in-production)

For production, keep using SMTP but **relay** your mail through a service that handles deliverability (sender reputation, SPF, DKIM, DMARC). Both options below are still SMTP from Sentry's perspective.

### [AWS SES relay](https://develop.sentry.dev/self-hosted/configuration/email.md#aws-ses-relay)

Recommended if you are using AWS SES for sending emails. AWS SES exposes an SMTP endpoint, and the built-in server relays your mail to it.

Provide `SES_USER`, `SES_PASSWORD`, and `SES_REGION` values in your `.env` file, and leave the mail configuration in `sentry/config.yml` as it is.

### [External SMTP relay](https://develop.sentry.dev/self-hosted/configuration/email.md#external-smtp-relay)

Recommended if you have an external SMTP server for sending emails. There are two ways to configure Sentry to use an external SMTP server:

1. Set the relevant `mail.*` settings in `config.yml` file to point directly to your external SMTP server. Refer to our [email service documentation](https://develop.sentry.dev/backend/email.md) for all the details on what each setting means and does.
2. Use the built-in SMTP server as a relay by setting a few environment variables on the `docker-compose.yml` file. You will need to leave the configuration on `sentry/config.yml` file as it is.

For the second option, it is preferred to modify through `docker-compose.override.yml` file so that your changes are not lost when updating self-hosted Sentry installation. Here is an example configuration:

```yaml
x-restart-policy: &restart_policy
  restart: unless-stopped

services:
  smtp:
    <<: *restart_policy
    image: registry.gitlab.com/egos-tech/smtp
    volumes:
      - "sentry-smtp:/var/spool/exim4"
      - "sentry-smtp-log:/var/log/exim4"
    environment:
      MAILNAME: ${SENTRY_MAIL_HOST:-}
      SMARTHOST_ADDRESS: "mail.example.com"
      SMARTHOST_PORT: "587"
      SMARTHOST_USER: "smtp_user"
      SMARTHOST_PASSWORD: "smtp_password"
      SMARTHOST_ALIASES: "*.example.com"
```

##### Warning

Because of the way configuration is layered, if you update `mail` settings through the web interface, you will need to also comment out the `mail.host: 'smtp'` default in your `config.yml` in order for your desired settings to be picked up.

## [Inbound Email](https://develop.sentry.dev/self-hosted/configuration/email.md#inbound-email)

Sentry has very limited inbound mail support through [Mailgun](https://documentation.mailgun.com/docs/mailgun/user-manual/receive-forward-store/receive-forward-store). You can find all the information regarding how to set this up over at our [inbound email service documentation](https://develop.sentry.dev/backend/email.md#inbound-email).
