SSO
Setting Up Email Notifications in Authentik
Also available in: RU

Part 8 of 9 in the series Authentik
- Authentik Overview - Architecture, Features, and Comparison with Keycloak
- OIDC, OAuth2, and Proxy Provider in Authentik - How to Protect Any Application
- Authentik - Initial Setup After Installation
- Setting Up Password Recovery in Authentik
- Setting Up User Enrollment and Invitation Processes in Authentik
- Setting Up Two-Factor Authentication in Authentik
- Cloudflare Turnstile in Authentik - Setting Up Login Form Protection
- Setting Up Email Notifications in Authentik
- Authentik - Setting Up a Reputation Policy
Contents
If you enjoyed this article, you can become a sponsor on Boosty.
I'm assuming you already have Authentik installed and configured (see the general overview and initial setup articles). In this article I'll talk about setting up email notifications in Authentik. They let you receive notifications about important events in the system - such as user logins, logouts, and authentication errors. This is useful for security monitoring and responding promptly to suspicious activity.
Configuring SMTP
For this setup, and for Authentik to work correctly in general, you need to have already configured your mail server settings in the .env environment variables file.
The block in .env looks like this (fill in the values from your mail provider):
AUTHENTIK_EMAIL__HOST=smtp.example.comAUTHENTIK_EMAIL__PORT=587AUTHENTIK_EMAIL__USERNAME=authentik@stilicho.ruAUTHENTIK_EMAIL__PASSWORD=<mailbox_password># STARTTLS, usually port 587AUTHENTIK_EMAIL__USE_TLS=true# SSL (implicit TLS), usually port 465AUTHENTIK_EMAIL__USE_SSL=falseAUTHENTIK_EMAIL__TIMEOUT=10AUTHENTIK_EMAIL__FROM=authentik@stilicho.ruAfter changing .env, recreate the containers: docker compose up -d.
You can verify that SMTP is configured correctly with the following command:
docker exec authentik_worker ak test_email your_email@domain.comThe authentik_worker container must be running, and the AUTHENTIK_EMAIL__* variables must be set correctly. If you haven't given your containers custom names via container_name, do the same thing through the service name: docker compose exec worker ak test_email your_email@domain.com.
Common mistakes that keep the test email from going out:
USE_TLSandUSE_SSLboth enabled. Pick one:USE_TLS=truefor STARTTLS (usually port 587) orUSE_SSL=truefor SSL (usually port 465).- Password in quotes. Quotes in
.envbecome part of the password, and authentication fails. - A single underscore in the variable names instead of two. It's
AUTHENTIK_EMAIL__HOST, with a double underscore afterEMAIL. - Your hosting provider blocks outgoing SMTP ports. Many VPS providers close ports 25/465/587 by default - in that case no settings will get the email out, and you need either a support request or an SMTP relay on a different port.
- The address in
AUTHENTIK_EMAIL__FROMdoesn't match the mailbox you authenticate as. Many mail services reject such messages.
Setting up event notifications
The application settings described in this article are accurate as of the time of writing.
Log in to Authentik as an administrator and go to:
Events → Notification Rules

In this article I'll show notification setup for only three basic events, which I consider the most important from a security standpoint. If needed, you can configure any other events you like.
Click Create. In the window that appears, give the rule a name that makes sense to you. In my case, this is a rule for monitoring logins to Authentik.
In the Groups section, specify which group's users will receive the notifications. In my case, this is authentik Admins.
In the Transport section, choose the notification delivery mechanism. In this case, email is used - the built-in default-email-transport, which sends mail through the global SMTP settings from .env. Next to it there's default-local-transport, which shows notifications right in the Authentik UI; you can select both at once.
Keep in mind: with no recipient, the notification simply isn't created. The rule will fire just fine, but you'll never see an email unless a group is selected under Groups (or the Send notification to event user option is on, which notifies the user the event is about).
In the Severity section, choose the importance level of the event. I use the Alert value, then click Create.

Go to the rule we just created and click Create and Bind Policy.

In the window that appears, select Event Matcher Policy.

Give the policy a name (for example, login). In the Action section, choose the event that will trigger the notification. In my case, this is Login.
The remaining parameters depend on your requirements - they're described in more detail in the official documentation. If your goal is simply to get notified about the event without additional filtering, you can leave them unchanged, as shown in my screenshot.

In the next window, set the processing order for the policy. I start with a value of 10 and click Finish.

To keep track of key user actions (or potential attackers), I create two more similar policies. The only difference is the event type:
LogoutLogin Failed


As a result, the list of bound policies looks roughly like this:

The rule fires when an event matches any of the bound policies, so a single rule with three policies covers all three events.
Once configured, it's recommended to run a test. To do this, you can log out and log back into Authentik, and also try logging in with incorrect credentials. If everything is set up correctly, an email notification will arrive for each corresponding event.
Notifications only tell you about failed logins - they don't stop them. To have Authentik actually react to password guessing, by showing a CAPTCHA or shutting the login down altogether, see the articles on the Reputation Policy and Cloudflare Turnstile.


