2020-02-29 00:43:59 +00:00
|
|
|
---
|
2022-06-15 07:51:47 +00:00
|
|
|
title: "SMTP"
|
|
|
|
description: "Configuring the SMTP Notifications Settings."
|
|
|
|
lead: "Authelia can send emails to users through an SMTP server. This section describes how to configure this."
|
2022-06-28 05:27:14 +00:00
|
|
|
date: 2020-02-29T01:43:59+01:00
|
2022-06-15 07:51:47 +00:00
|
|
|
draft: false
|
|
|
|
images: []
|
|
|
|
menu:
|
|
|
|
configuration:
|
|
|
|
parent: "notifications"
|
|
|
|
weight: 107200
|
|
|
|
toc: true
|
|
|
|
aliases:
|
|
|
|
- /docs/configuration/notifier/smtp.html
|
2020-02-29 00:43:59 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
## Configuration
|
|
|
|
|
2020-02-29 00:43:59 +00:00
|
|
|
```yaml
|
|
|
|
notifier:
|
[FEATURE] Notifier Startup Checks (#889)
* implement SMTP notifier startup check
* check dial, starttls, auth, mail from, rcpt to, reset, and quit
* log the error on failure
* implement mock
* misc optimizations, adjustments, and refactoring
* implement validate_skip config option
* fix comments to end with period
* fix suites that used smtp notifier without a smtp container
* add docs
* add file notifier startup check
* move file mode into const.go
* disable gosec linting on insecureskipverify since it's intended, warned, and discouraged
* minor PR commentary adjustment
* apply suggestions from code review
Co-Authored-By: Amir Zarrinkafsh <nightah@me.com>
2020-04-21 04:59:38 +00:00
|
|
|
disable_startup_check: false
|
2020-02-29 00:43:59 +00:00
|
|
|
smtp:
|
|
|
|
host: 127.0.0.1
|
|
|
|
port: 1025
|
2021-08-10 00:52:41 +00:00
|
|
|
timeout: 5s
|
|
|
|
username: test
|
|
|
|
password: password
|
2021-11-30 11:15:21 +00:00
|
|
|
sender: "Authelia <admin@example.com>"
|
2020-11-04 23:22:10 +00:00
|
|
|
identifier: localhost
|
2020-04-09 00:21:28 +00:00
|
|
|
subject: "[Authelia] {title}"
|
2020-08-21 02:16:23 +00:00
|
|
|
startup_check_address: test@authelia.com
|
|
|
|
disable_require_tls: false
|
|
|
|
disable_html_emails: false
|
2021-01-04 10:28:55 +00:00
|
|
|
tls:
|
2021-04-11 11:25:03 +00:00
|
|
|
server_name: smtp.example.com
|
2021-01-04 10:28:55 +00:00
|
|
|
skip_verify: false
|
|
|
|
minimum_version: TLS1.2
|
2020-02-29 00:43:59 +00:00
|
|
|
```
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
## Options
|
|
|
|
|
2020-12-16 00:31:39 +00:00
|
|
|
### host
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The hostname of the SMTP server.
|
|
|
|
|
2020-12-29 19:33:57 +00:00
|
|
|
If utilising an IPv6 literal address it must be enclosed by square brackets and quoted:
|
2021-01-04 10:28:55 +00:00
|
|
|
|
2020-12-16 00:31:39 +00:00
|
|
|
```yaml
|
|
|
|
host: "[fd00:1111:2222:3333::1]"
|
|
|
|
```
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
### port
|
|
|
|
|
2022-06-15 07:51:47 +00:00
|
|
|
{{< confkey type="integer" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The port the SMTP service is listening on.
|
|
|
|
|
2021-08-10 00:52:41 +00:00
|
|
|
### timeout
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="duration" default="5s" required="no" >}}
|
2021-08-10 00:52:41 +00:00
|
|
|
|
|
|
|
The SMTP connection timeout.
|
|
|
|
|
|
|
|
### username
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no" >}}
|
2021-08-10 00:52:41 +00:00
|
|
|
|
|
|
|
The username sent for authentication with the SMTP server. Paired with the password.
|
|
|
|
|
|
|
|
### password
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no" >}}
|
2021-08-10 00:52:41 +00:00
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
*__Important Note:__ This can also be defined using a [secret](../methods/secrets.md) which is __strongly recommended__
|
|
|
|
especially for containerized deployments.*
|
2022-06-15 07:51:47 +00:00
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
The password paired with the [username](#username) sent for authentication with the SMTP server.
|
|
|
|
|
|
|
|
It's __strongly recommended__ this is a
|
|
|
|
[Random Alphanumeric String](../miscellaneous/guides.md#generating-a-random-alphanumeric-string) with 64 or more
|
|
|
|
characters and the user password is changed to this value.
|
2021-08-10 00:52:41 +00:00
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
### sender
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2021-11-30 11:15:21 +00:00
|
|
|
The sender is used to construct both the SMTP command `MAIL FROM` and to add the `FROM` header. This address must be
|
2022-06-15 07:51:47 +00:00
|
|
|
in [RFC5322](https://www.rfc-editor.org/rfc/rfc5322.html#section-3.4) format. This means it must one of two formats:
|
|
|
|
|
|
|
|
* jsmith@domain.com
|
|
|
|
* John Smith <jsmith@domain.com>
|
2021-11-30 11:15:21 +00:00
|
|
|
|
|
|
|
The `MAIL FROM` command sent to SMTP servers will not include the name portion, this is only set in the `FROM` as per
|
|
|
|
specifications.
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2021-08-10 00:52:41 +00:00
|
|
|
### identifier
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" default="localhost" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2020-11-04 23:22:10 +00:00
|
|
|
The name to send to the SMTP server as the identifier with the HELO/EHLO command. Some SMTP providers like Google Mail
|
|
|
|
reject the message if it's localhost.
|
|
|
|
|
2020-08-21 02:16:23 +00:00
|
|
|
### subject
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" default="[Authelia] {title}" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2020-08-21 02:16:23 +00:00
|
|
|
This is the subject Authelia will use in the email, it has a single placeholder at present `{title}` which should
|
|
|
|
be included in all emails as it is the internal descriptor for the contents of the email.
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
### startup_check_address
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" default="test@authelia.com" required="no" >}}
|
|
|
|
|
|
|
|
__Authelia__ checks the SMTP server is valid at startup, one of the checks requires we ask the SMTP server if it can
|
2021-04-11 11:25:03 +00:00
|
|
|
send an email from us to a specific address, this is that address. No email is actually sent in the process. It is fine
|
|
|
|
to leave this as is, but you can customize it if you have issues or you desire to.
|
|
|
|
|
2020-08-21 02:16:23 +00:00
|
|
|
### disable_require_tls
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
For security reasons the default settings for Authelia require the SMTP connection is encrypted by TLS. See [security]
|
|
|
|
for more information. This option disables this measure (not recommended).
|
2020-08-21 02:16:23 +00:00
|
|
|
|
|
|
|
### disable_html_emails
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
|
|
|
|
|
|
|
This setting completely disables HTML formatting of emails and only sends text emails. __Authelia__ by default sends
|
2021-04-11 11:25:03 +00:00
|
|
|
mixed emails which contain both HTML and text so this option is rarely necessary.
|
|
|
|
|
|
|
|
### tls
|
|
|
|
|
|
|
|
Controls the TLS connection validation process. You can see how to configure the tls section
|
2022-06-15 07:51:47 +00:00
|
|
|
[here](../prologue/common.md#tls-configuration).
|
2020-08-21 02:16:23 +00:00
|
|
|
|
2020-02-29 05:15:03 +00:00
|
|
|
## Using Gmail
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
You need to generate an app password in order to use Gmail SMTP servers. The process is described
|
|
|
|
[here](https://support.google.com/accounts/answer/185833?hl=en).
|
2020-02-29 00:43:59 +00:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
notifier:
|
2020-04-11 04:46:07 +00:00
|
|
|
smtp:
|
|
|
|
username: myaccount@gmail.com
|
2022-06-15 07:51:47 +00:00
|
|
|
# Password can also be set using a secret: https://www.authelia.com/configuration/methods/secrets/
|
2020-04-11 04:46:07 +00:00
|
|
|
password: yourapppassword
|
|
|
|
sender: admin@example.com
|
|
|
|
host: smtp.gmail.com
|
|
|
|
port: 587
|
2020-04-09 00:21:28 +00:00
|
|
|
```
|