mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.1 KiB
89 lines
3.1 KiB
5 years ago
|
---
|
||
|
date: "2019-10-15T10:10:00+05:00"
|
||
2 years ago
|
title: "Email setup"
|
||
5 years ago
|
slug: "email-setup"
|
||
1 year ago
|
sidebar_position: 12
|
||
4 years ago
|
toc: false
|
||
5 years ago
|
draft: false
|
||
2 years ago
|
aliases:
|
||
|
- /en-us/email-setup
|
||
5 years ago
|
menu:
|
||
|
sidebar:
|
||
2 years ago
|
parent: "administration"
|
||
5 years ago
|
name: "Email setup"
|
||
1 year ago
|
sidebar_position: 12
|
||
5 years ago
|
identifier: "email-setup"
|
||
|
---
|
||
|
|
||
|
# Email setup
|
||
|
|
||
3 years ago
|
Gitea has mailer functionality for sending transactional emails (such as registration confirmation). It can be configured to either use Sendmail (or compatible MTAs like Postfix and msmtp) or directly use SMTP server.
|
||
5 years ago
|
|
||
3 years ago
|
## Using Sendmail
|
||
4 years ago
|
|
||
3 years ago
|
Use `sendmail` command as mailer.
|
||
|
|
||
|
Note: For use in the official Gitea Docker image, please configure with the SMTP version (see the following section).
|
||
|
|
||
|
Note: For Internet-facing sites consult documentation of your MTA for instructions to send emails over TLS. Also set up SPF, DMARC, and DKIM DNS records to make emails sent be accepted as legitimate by various email providers.
|
||
4 years ago
|
|
||
5 years ago
|
```ini
|
||
|
[mailer]
|
||
5 years ago
|
ENABLED = true
|
||
|
FROM = gitea@mydomain.com
|
||
|
MAILER_TYPE = sendmail
|
||
|
SENDMAIL_PATH = /usr/sbin/sendmail
|
||
3 years ago
|
SENDMAIL_ARGS = "--" ; most "sendmail" programs take options, "--" will prevent an email address being interpreted as an option.
|
||
5 years ago
|
```
|
||
|
|
||
3 years ago
|
## Using SMTP
|
||
|
|
||
|
Directly use SMTP server as relay. This option is useful if you don't want to set up MTA on your instance but you have an account at email provider.
|
||
4 years ago
|
|
||
5 years ago
|
```ini
|
||
|
[mailer]
|
||
|
ENABLED = true
|
||
|
FROM = gitea@mydomain.com
|
||
|
MAILER_TYPE = smtp
|
||
2 years ago
|
SMTP_ADDR = mail.mydomain.com
|
||
|
SMTP_PORT = 587
|
||
5 years ago
|
IS_TLS_ENABLED = true
|
||
|
USER = gitea@mydomain.com
|
||
|
PASSWD = `password`
|
||
5 years ago
|
```
|
||
|
|
||
3 years ago
|
Restart Gitea for the configuration changes to take effect.
|
||
5 years ago
|
|
||
3 years ago
|
To send a test email to validate the settings, go to Gitea > Site Administration > Configuration > SMTP Mailer Configuration.
|
||
5 years ago
|
|
||
1 year ago
|
For the full list of options check the [Config Cheat Sheet](administration/config-cheat-sheet.md)
|
||
5 years ago
|
|
||
3 years ago
|
Please note: authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost`. TLS encryption can be through:
|
||
2 years ago
|
|
||
|
- STARTTLS (also known as Opportunistic TLS) via port 587. Initial connection is done over cleartext, but then be upgraded over TLS if the server supports it.
|
||
|
- SMTPS connection (SMTP over TLS) via the default port 465. Connection to the server use TLS from the beginning.
|
||
|
- Forced SMTPS connection with `IS_TLS_ENABLED=true`. (These are both known as Implicit TLS.)
|
||
3 years ago
|
This is due to protections imposed by the Go internal libraries against STRIPTLS attacks.
|
||
|
|
||
|
Note that Implicit TLS is recommended by [RFC8314](https://tools.ietf.org/html/rfc8314#section-3) since 2018.
|
||
5 years ago
|
|
||
5 years ago
|
### Gmail
|
||
|
|
||
|
The following configuration should work with GMail's SMTP server:
|
||
|
|
||
|
```ini
|
||
|
[mailer]
|
||
|
ENABLED = true
|
||
2 years ago
|
HOST = smtp.gmail.com:465 ; Remove this line for Gitea >= 1.18.0
|
||
2 years ago
|
SMTP_ADDR = smtp.gmail.com
|
||
|
SMTP_PORT = 465
|
||
2 years ago
|
FROM = example.user@gmail.com
|
||
|
USER = example.user
|
||
2 years ago
|
PASSWD = `***`
|
||
5 years ago
|
MAILER_TYPE = smtp
|
||
|
IS_TLS_ENABLED = true
|
||
|
```
|
||
2 years ago
|
|
||
|
Note that you'll need to create and use an [App password](https://support.google.com/accounts/answer/185833?hl=en) by enabling 2FA on your Google
|
||
|
account. You won't be able to use your Google account password directly.
|