2019-10-16 17:04:20 +05:30
---
date: "2019-10-15T10:10:00+05:00"
2023-04-06 14:36:32 +05:30
title: "Email setup"
2019-10-16 17:04:20 +05:30
slug: "email-setup"
2023-07-26 10:23:13 +05:30
sidebar_position: 12
2020-12-09 12:17:06 +05:30
toc: false
2019-10-16 17:04:20 +05:30
draft: false
Refactor docs (#23752)
This was intended to be a small followup for
https://github.com/go-gitea/gitea/pull/23712, but...here we are.
1. Our docs currently use `slug` as the entire URL, which makes
refactoring tricky (see https://github.com/go-gitea/gitea/pull/23712).
Instead, this PR attempts to make future refactoring easier by using
slugs as an extension of the section. (Hugo terminology)
- What the above boils down to is this PR attempts to use directory
organization as URL management. e.g. `usage/comparison.en-us.md` ->
`en-us/usage/comparison/`, `usage/packages/overview.en-us.md` ->
`en-us/usage/packages/overview/`
- Technically we could even remove `slug`, as Hugo defaults to using
filename, however at least with this PR it means `slug` only needs to be
the name for the **current file** rather than an entire URL
2. This PR adds appropriate aliases (redirects) for pages, so anything
on the internet that links to our docs should hopefully not break.
3. A minor nit I've had for a while, renaming `seek-help` to `support`.
It's a minor thing, but `seek-help` has a strange connotation to it.
4. The commits are split such that you can review the first which is the
"actual" change, and the second is added redirects so that the first
doesn't break links elsewhere.
---------
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-28 09:03:41 +05:30
aliases:
- /en-us/email-setup
2019-10-16 17:04:20 +05:30
menu:
sidebar:
2023-03-23 20:48:24 +05:30
parent: "administration"
2019-10-16 17:04:20 +05:30
name: "Email setup"
2023-07-26 10:23:13 +05:30
sidebar_position: 12
2019-10-16 17:04:20 +05:30
identifier: "email-setup"
---
# Email setup
2021-07-13 01:35:40 +05:30
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.
2019-10-16 17:04:20 +05:30
2021-07-13 01:35:40 +05:30
## Using Sendmail
2020-12-09 12:17:06 +05:30
2021-07-13 01:35:40 +05:30
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.
2020-12-09 12:17:06 +05:30
2019-10-16 17:04:20 +05:30
```ini
[mailer]
2020-03-13 20:50:14 +05:30
ENABLED = true
FROM = gitea@mydomain.com
2023-07-26 19:20:15 +05:30
PROTOCOL = sendmail
2020-03-13 20:50:14 +05:30
SENDMAIL_PATH = /usr/sbin/sendmail
2022-03-18 19:49:02 +05:30
SENDMAIL_ARGS = "--" ; most "sendmail" programs take options, "--" will prevent an email address being interpreted as an option.
2020-03-13 20:50:14 +05:30
```
2021-07-13 01:35:40 +05:30
## 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.
2020-12-09 12:17:06 +05:30
2020-03-13 20:50:14 +05:30
```ini
[mailer]
ENABLED = true
FROM = gitea@mydomain.com
2023-07-26 19:20:15 +05:30
PROTOCOL = smtps
2022-11-01 03:32:37 +05:30
SMTP_ADDR = mail.mydomain.com
SMTP_PORT = 587
2020-03-13 20:50:14 +05:30
USER = gitea@mydomain.com
PASSWD = `password`
2019-10-16 17:04:20 +05:30
```
2021-07-13 01:35:40 +05:30
Restart Gitea for the configuration changes to take effect.
2019-10-16 17:04:20 +05:30
2021-07-13 01:35:40 +05:30
To send a test email to validate the settings, go to Gitea > Site Administration > Configuration > SMTP Mailer Configuration.
2019-10-16 17:04:20 +05:30
2023-07-26 10:23:13 +05:30
For the full list of options check the [Config Cheat Sheet ](administration/config-cheat-sheet.md )
2020-04-07 01:48:42 +05:30
2021-07-13 01:35:40 +05:30
Please note: authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost` . TLS encryption can be through:
2022-07-28 06:52:47 +05:30
- 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.
2023-11-25 07:46:29 +05:30
- Forced SMTPS connection with `PROTOCOL=smtps` . (These are both known as Implicit TLS.)
2021-07-13 01:35:40 +05:30
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.
2020-05-25 04:26:18 +05:30
2020-04-07 01:48:42 +05:30
### Gmail
The following configuration should work with GMail's SMTP server:
```ini
[mailer]
ENABLED = true
2023-01-02 08:22:36 +05:30
HOST = smtp.gmail.com:465 ; Remove this line for Gitea >= 1.18.0
2022-11-01 03:32:37 +05:30
SMTP_ADDR = smtp.gmail.com
SMTP_PORT = 465
2023-01-02 08:22:36 +05:30
FROM = example.user@gmail.com
USER = example.user
2023-04-04 22:49:01 +05:30
PASSWD = `***`
2023-08-03 15:50:40 +05:30
PROTOCOL = smtps
2020-04-07 01:48:42 +05:30
```
2023-01-02 08:22:36 +05:30
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.