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
|
|
|
|
|
2023-05-04 11:23:15 +00:00
|
|
|
{{< config-alert-example >}}
|
|
|
|
|
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:
|
2023-05-07 06:39:17 +00:00
|
|
|
address: 'smtp://127.0.0.1:25'
|
|
|
|
timeout: '5s'
|
|
|
|
username: 'test'
|
|
|
|
password: 'password'
|
2021-11-30 11:15:21 +00:00
|
|
|
sender: "Authelia <admin@example.com>"
|
2023-05-07 06:39:17 +00:00
|
|
|
identifier: 'localhost'
|
2020-04-09 00:21:28 +00:00
|
|
|
subject: "[Authelia] {title}"
|
2023-05-07 06:39:17 +00:00
|
|
|
startup_check_address: 'test@authelia.com'
|
2020-08-21 02:16:23 +00:00
|
|
|
disable_require_tls: false
|
2022-10-02 02:51:19 +00:00
|
|
|
disable_starttls: false
|
2020-08-21 02:16:23 +00:00
|
|
|
disable_html_emails: false
|
2021-01-04 10:28:55 +00:00
|
|
|
tls:
|
2023-05-07 06:39:17 +00:00
|
|
|
server_name: 'smtp.example.com'
|
2021-01-04 10:28:55 +00:00
|
|
|
skip_verify: false
|
2023-05-07 06:39:17 +00:00
|
|
|
minimum_version: 'TLS1.2'
|
|
|
|
maximum_version: 'TLS1.3'
|
2022-10-21 08:41:33 +00:00
|
|
|
certificate_chain: |
|
|
|
|
-----BEGIN CERTIFICATE-----
|
|
|
|
MIIC5jCCAc6gAwIBAgIRAK4Sj7FiN6PXo/urPfO4E7owDQYJKoZIhvcNAQELBQAw
|
|
|
|
EzERMA8GA1UEChMIQXV0aGVsaWEwHhcNNzAwMTAxMDAwMDAwWhcNNzEwMTAxMDAw
|
|
|
|
MDAwWjATMREwDwYDVQQKEwhBdXRoZWxpYTCCASIwDQYJKoZIhvcNAQEBBQADggEP
|
|
|
|
ADCCAQoCggEBAPKv3pSyP4ozGEiVLJ14dIWFCEGEgq7WUMI0SZZqQA2ID0L59U/Q
|
|
|
|
/Usyy7uC9gfMUzODTpANtkOjFQcQAsxlR1FOjVBrX5QgjSvXwbQn3DtwMA7XWSl6
|
|
|
|
LuYx2rBYSlMSN5UZQm/RxMtXfLK2b51WgEEYDFi+nECSqKzR4R54eOPkBEWRfvuY
|
|
|
|
91AMjlhpivg8e4JWkq4LVQUKbmiFYwIdK8XQiN4blY9WwXwJFYs5sQ/UYMwBFi0H
|
|
|
|
kWOh7GEjfxgoUOPauIueZSMSlQp7zqAH39N0ZSYb6cS0Npj57QoWZSY3ak87ebcR
|
|
|
|
Nf4rCvZLby7LoN7qYCKxmCaDD3x2+NYpWH8CAwEAAaM1MDMwDgYDVR0PAQ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ywZ
|
|
|
|
9oGAn+fz2d/0/JAH/FpFPgsCgYEAp/ipZgPzziiZ9ov1wbdAQcWRj7RaWnssPFpX
|
|
|
|
jXwEiXT3CgEMO4MJ4+KWIWOChrti3qFBg6i6lDyyS6Qyls7sLFbUdC7HlTcrOEMe
|
|
|
|
rBoTcCI1GqZNlqWOVQ65ZIEiaI7o1vPBZo2GMQEZuq8mDKFsOMThvvTrM5cAep84
|
|
|
|
n6HJR4ECgYABWcbsSnr0MKvVth/inxjbKapbZnp2HUCuw87Ie5zK2Of/tbC20wwk
|
|
|
|
yKw3vrGoE3O1t1g2m2tn8UGGASeZ842jZWjIODdSi5+icysQGuULKt86h/woz2SQ
|
|
|
|
27GoE2i5mh6Yez6VAYbUuns3FcwIsMyWLq043Tu2DNkx9ijOOAuQzw^invalid..
|
|
|
|
DO NOT USE==
|
|
|
|
-----END RSA PRIVATE KEY-----
|
2020-02-29 00:43:59 +00:00
|
|
|
```
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
## Options
|
|
|
|
|
2023-05-04 11:23:15 +00:00
|
|
|
This section describes the individual configuration options.
|
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
### address
|
2022-06-15 07:51:47 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
{{< confkey type="address" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
*__Reference Note:__ This configuration option uses the [address common syntax](../prologue/common.md#address). Please
|
|
|
|
see the [documentation](../prologue/common.md#address) on this format for more information.*
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
Configures the address for the SMTP Server. The address itself is a connector and the scheme must be `smtp`,
|
|
|
|
`submission`, or `submissions`. The only difference between these schemes are the default ports and `submissions`
|
|
|
|
requires a TLS transport per [SMTP Ports Security Measures][docs-security-smtp-port], whereas `submission` and `smtp`
|
|
|
|
use a standard TCP transport and typically enforce StartTLS.
|
2021-01-04 10:28:55 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
[docs-security-smtp-port]: ../../overview/security/measures.md#smtp-ports
|
2022-09-06 02:01:46 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
__Examples:__
|
2022-09-06 02:01:46 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
```yaml
|
|
|
|
notifier:
|
|
|
|
smtp:
|
|
|
|
address: 'smtp://127.0.0.1:25'
|
|
|
|
```
|
2022-09-06 02:01:46 +00:00
|
|
|
|
2023-05-07 06:39:17 +00:00
|
|
|
```yaml
|
|
|
|
notifier:
|
|
|
|
smtp:
|
|
|
|
address: 'submissions://[fd00:1111:2222:3333::1]:465'
|
|
|
|
```
|
2021-04-11 11:25:03 +00:00
|
|
|
|
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
|
|
|
|
2023-05-07 05:48:26 +00:00
|
|
|
*__Reference Note:__ This configuration option uses the [duration common syntax](../prologue/common.md#duration).
|
|
|
|
Please see the [documentation](../prologue/common.md#duration) on this format for more information.*
|
|
|
|
|
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
|
2022-10-23 07:09:19 +00:00
|
|
|
[Random Alphanumeric String](../../reference/guides/generating-secure-values.md#generating-a-random-alphanumeric-string) with 64 or more
|
2022-06-21 09:45:08 +00:00
|
|
|
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
|
2023-02-02 01:30:06 +00:00
|
|
|
in [RFC5322](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4) format. This means it must one of two formats:
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
* 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
|
|
|
|
2022-10-02 02:51:19 +00:00
|
|
|
### disable_starttls
|
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
|
|
|
|
|
|
|
Some SMTP servers ignore SMTP specifications and claim to support STARTTLS when they in fact do not.
|
|
|
|
For security reasons Authelia refuses to send messages to these servers.
|
2022-10-21 08:41:33 +00:00
|
|
|
This option disables this measure and is enabled *__AT YOUR OWN RISK__*. It's *__strongly recommended__*
|
|
|
|
that instead of enabling this option you either fix the issue with the SMTP server's configuration or
|
2022-12-19 04:04:02 +00:00
|
|
|
have the administrators of the server fix it. If the issue can't be fixed via the SMTP server configuration we recommend
|
2022-10-02 02:51:19 +00:00
|
|
|
lodging an issue with the authors of the SMTP server.
|
2022-12-19 04:04:02 +00:00
|
|
|
|
2022-10-02 02:51:19 +00:00
|
|
|
See [security] for more information.
|
|
|
|
|
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:
|
2023-05-07 06:39:17 +00:00
|
|
|
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/
|
2023-05-07 06:39:17 +00:00
|
|
|
password: 'yourapppassword'
|
|
|
|
sender: 'admin@example.com'
|
|
|
|
host: 'smtp.gmail.com'
|
2020-04-11 04:46:07 +00:00
|
|
|
port: 587
|
2020-04-09 00:21:28 +00:00
|
|
|
```
|