Skip to main content

Email

This page covers both configuring authentik to send emails and testing that email delivery is working.

authentik can be configured with global email settings used to notify administrators about alerts, configuration issues, and new releases. They can also be used alongside notification rules to send emails based on any event that occurs within authentik.

authentik also provides Email stages, which are used to send emails to users for actions such as account recovery and verification. Email stages can be configured to use the global email settings or their own specific email settings.

warning

Some hosting providers block outgoing SMTP ports, in which case you will need to host an SMTP relay on a different port with a different provider.

Global email settings

To configure global email settings, append the following block to your .env file:

# SMTP Host Emails are sent to
AUTHENTIK_EMAIL__HOST=localhost
AUTHENTIK_EMAIL__PORT=25
# Optionally authenticate (don't add quotation marks to your password)
AUTHENTIK_EMAIL__USERNAME=
AUTHENTIK_EMAIL__PASSWORD=
# Use StartTLS
AUTHENTIK_EMAIL__USE_TLS=false
# Use SSL
AUTHENTIK_EMAIL__USE_SSL=false
AUTHENTIK_EMAIL__TIMEOUT=10
# Email address authentik will send from, should have a correct @domain
AUTHENTIK_EMAIL__FROM=authentik@localhost

Testing email configuration

To test whether the global email settings are configured correctly, you can use the following command on your authentik server:

ak test_email <to_address>

To test the email settings of a specific email stage, you can optionally provide the -S parameter:

ak test_email <to_address> [-S <stage_name>]

To run this command with Docker Compose:

docker compose exec worker ak test_email [...]

Google Workspace SMTP relay configuration

To send email through Google SMTP servers, the easiest and most reliable method is often to use Google's SMTP relay service. Google provides detailed guidance in their documentation: Send email from a printer, scanner, or app.

First, confirm the outbound IP address that authentik uses to send emails. Follow Google's documentation to add the IP address or addresses to the SMTP relay service options in your workspace's Gmail settings.

  • Set Allowed Senders to Only addresses in my domains.
  • Set Authentication to Only accept mail from the specified IP addresses.
  • Do not set Require SMTP Authentication.
  • Select Require TLS encryption.

If you are using Docker Compose, set the following environment variables for authentik:

AUTHENTIK_EMAIL__HOST=smtp-relay.gmail.com
AUTHENTIK_EMAIL__PORT=587
AUTHENTIK_EMAIL__USE_TLS=true
AUTHENTIK_EMAIL__USE_SSL=false
AUTHENTIK_EMAIL__TIMEOUT=30

Redeploy the authentik containers, then use the ak test_email command to confirm that email delivery works.

SMTP server with TLS verification

If you're configuring authentik to send email via an SMTP server with TLS enabled, you must mount the certificate used for authentication in your authentik worker and server containers:

  1. Add the following configuration to the server and worker containers in your Docker Compose file:
volumes:
- /path/to/<cert_name>.crt:/etc/ssl/certs/<cert_name>.crt:ro
environment:
- SSL_CERT_FILE="/etc/ssl/certs/<cert_name>.crt"
  1. Redeploy the containers for the changes to take effect.