2020-02-29 07:43:59 +07:00
|
|
|
---
|
|
|
|
layout: default
|
|
|
|
title: SMTP
|
|
|
|
parent: Notifier
|
|
|
|
grand_parent: Configuration
|
|
|
|
nav_order: 2
|
|
|
|
---
|
|
|
|
|
|
|
|
# SMTP
|
|
|
|
**Authelia** can send emails to users through an SMTP server.
|
|
|
|
It can be configured as described below.
|
|
|
|
|
2021-04-11 18:25:03 +07:00
|
|
|
## Configuration
|
|
|
|
|
2020-02-29 07:43:59 +07: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 11:59:38 +07:00
|
|
|
disable_startup_check: false
|
2020-02-29 07:43:59 +07:00
|
|
|
smtp:
|
|
|
|
host: 127.0.0.1
|
|
|
|
port: 1025
|
2021-08-10 07:52:41 +07:00
|
|
|
timeout: 5s
|
|
|
|
username: test
|
|
|
|
password: password
|
2020-02-29 07:43:59 +07:00
|
|
|
sender: admin@example.com
|
2020-11-05 06:22:10 +07:00
|
|
|
identifier: localhost
|
2020-04-09 07:21:28 +07:00
|
|
|
subject: "[Authelia] {title}"
|
2020-08-21 09:16:23 +07:00
|
|
|
startup_check_address: test@authelia.com
|
|
|
|
disable_require_tls: false
|
|
|
|
disable_html_emails: false
|
2021-01-04 17:28:55 +07:00
|
|
|
tls:
|
2021-04-11 18:25:03 +07:00
|
|
|
server_name: smtp.example.com
|
2021-01-04 17:28:55 +07:00
|
|
|
skip_verify: false
|
|
|
|
minimum_version: TLS1.2
|
2020-02-29 07:43:59 +07:00
|
|
|
```
|
|
|
|
|
2021-04-11 18:25:03 +07:00
|
|
|
## Options
|
|
|
|
|
2020-12-16 07:31:39 +07:00
|
|
|
### host
|
2021-04-11 18:25:03 +07:00
|
|
|
<div markdown="1">
|
|
|
|
type: integer
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
required: yes
|
|
|
|
{: .label .label-config .label-red }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The hostname of the SMTP server.
|
|
|
|
|
2020-12-30 02:33:57 +07:00
|
|
|
If utilising an IPv6 literal address it must be enclosed by square brackets and quoted:
|
2021-01-04 17:28:55 +07:00
|
|
|
|
2020-12-16 07:31:39 +07:00
|
|
|
```yaml
|
|
|
|
host: "[fd00:1111:2222:3333::1]"
|
|
|
|
```
|
|
|
|
|
2021-04-11 18:25:03 +07:00
|
|
|
### port
|
|
|
|
|
|
|
|
<div markdown="1">
|
|
|
|
type: integer
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
required: yes
|
|
|
|
{: .label .label-config .label-red }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The port the SMTP service is listening on.
|
|
|
|
|
2021-08-10 07:52:41 +07:00
|
|
|
### timeout
|
|
|
|
<div markdown="1">
|
|
|
|
type: duration
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: 5s
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The SMTP connection timeout.
|
|
|
|
|
|
|
|
### username
|
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The username sent for authentication with the SMTP server. Paired with the password.
|
|
|
|
|
|
|
|
### password
|
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The password sent for authentication with the SMTP server. Paired with the username. Can also be defined using a
|
|
|
|
[secret](../secrets.md) which is the recommended for containerized deployments.
|
|
|
|
|
2021-04-11 18:25:03 +07:00
|
|
|
### sender
|
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The address sent in the FROM header for the email. Basically who the email appears to come from. It should be noted
|
|
|
|
that some SMTP servers require the username provided to have access to send from the specific address listed here.
|
|
|
|
|
2021-08-10 07:52:41 +07:00
|
|
|
### identifier
|
2021-04-11 18:25:03 +07:00
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: localhost
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
2020-11-05 06:22:10 +07: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 09:16:23 +07:00
|
|
|
### subject
|
2021-04-11 18:25:03 +07:00
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: [Authelia] {title}
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
2020-08-21 09:16:23 +07: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 18:25:03 +07:00
|
|
|
### startup_check_address
|
|
|
|
<div markdown="1">
|
|
|
|
type: string
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: test@authelia.com
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
**Authelia** checks the SMTP server is valid at startup, one of the checks requires we ask the SMTP server if it can
|
|
|
|
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 09:16:23 +07:00
|
|
|
### disable_require_tls
|
2021-04-11 18:25:03 +07:00
|
|
|
<div markdown="1">
|
|
|
|
type: boolean
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: false
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
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 09:16:23 +07:00
|
|
|
|
|
|
|
### disable_html_emails
|
2021-04-11 18:25:03 +07:00
|
|
|
<div markdown="1">
|
|
|
|
type: boolean
|
|
|
|
{: .label .label-config .label-purple }
|
|
|
|
default: false
|
|
|
|
{: .label .label-config .label-blue }
|
|
|
|
required: no
|
|
|
|
{: .label .label-config .label-green }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
This setting completely disables HTML formatting of emails and only sends text emails. **Authelia** by default sends
|
|
|
|
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
|
|
|
|
[here](../index.md#tls-configuration).
|
2020-08-21 09:16:23 +07:00
|
|
|
|
|
|
|
|
2020-02-29 12:15:03 +07:00
|
|
|
## Using Gmail
|
2020-02-29 07:43:59 +07: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)
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
notifier:
|
2020-04-11 11:46:07 +07:00
|
|
|
smtp:
|
|
|
|
username: myaccount@gmail.com
|
2021-04-11 18:25:03 +07:00
|
|
|
# Password can also be set using a secret: https://www.authelia.com/docs/configuration/secrets.html
|
2020-04-11 11:46:07 +07:00
|
|
|
password: yourapppassword
|
|
|
|
sender: admin@example.com
|
|
|
|
host: smtp.gmail.com
|
|
|
|
port: 587
|
2020-04-09 07:21:28 +07:00
|
|
|
```
|