Self-Hosted Email
Set up and configure email notifications for your self-hosted Sentry instance
Note
After changing configuration files, re-run the ./install.sh script, to rebuild and restart the containers. See the configuration section for more information.
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.
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.
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.
This is the default configuration for self-hosted Sentry, powered by egos-tech/smtp.
All you need to do is set a valid address for the mail.from setting in config.yml, and the FQDN 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.
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.
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.
Recommended if you have an external SMTP server for sending emails. There are two ways to configure Sentry to use an external SMTP server:
- Set the relevant
mail.*settings inconfig.ymlfile to point directly to your external SMTP server. Refer to our email service documentation for all the details on what each setting means and does. - Use the built-in SMTP server as a relay by setting a few environment variables on the
docker-compose.ymlfile. You will need to leave the configuration onsentry/config.ymlfile 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:
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"
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.
Sentry has very limited inbound mail support through Mailgun. You can find all the information regarding how to set this up over at our inbound email service documentation.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").