1---
2date: "2019-10-15T10:10:00+05:00"
3title: "Usage: Email setup"
4slug: "email-setup"
5weight: 12
6toc: false
7draft: false
8menu:
9  sidebar:
10    parent: "usage"
11    name: "Email setup"
12    weight: 12
13    identifier: "email-setup"
14---
15
16# Email setup
17
18**Table of Contents**
19
20{{< toc >}}
21
22Gitea 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.
23
24## Using Sendmail
25
26Use `sendmail` command as mailer.
27
28Note: For use in the official Gitea Docker image, please configure with the SMTP version (see the following section).
29
30Note: 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.
31
32```ini
33[mailer]
34ENABLED       = true
35FROM          = gitea@mydomain.com
36MAILER_TYPE   = sendmail
37SENDMAIL_PATH = /usr/sbin/sendmail
38```
39
40## Using SMTP
41
42Directly 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.
43
44```ini
45[mailer]
46ENABLED        = true
47FROM           = gitea@mydomain.com
48MAILER_TYPE    = smtp
49HOST           = mail.mydomain.com:587
50IS_TLS_ENABLED = true
51USER           = gitea@mydomain.com
52PASSWD         = `password`
53```
54
55Restart Gitea for the configuration changes to take effect.
56
57To send a test email to validate the settings, go to Gitea > Site Administration > Configuration > SMTP Mailer Configuration.
58
59For the full list of options check the [Config Cheat Sheet]({{< relref "doc/advanced/config-cheat-sheet.en-us.md" >}})
60
61Please note: authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost`. TLS encryption can be through:
62  - 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.
63  - SMTPS connection (SMTP over TLS) via the default port 465. Connection to the server use TLS from the beginning.
64  - Forced SMTPS connection with `IS_TLS_ENABLED=true`. (These are both known as Implicit TLS.)
65This is due to protections imposed by the Go internal libraries against STRIPTLS attacks.
66
67Note that Implicit TLS is recommended by [RFC8314](https://tools.ietf.org/html/rfc8314#section-3) since 2018.
68
69### Gmail
70
71The following configuration should work with GMail's SMTP server:
72
73```ini
74[mailer]
75ENABLED        = true
76HOST           = smtp.gmail.com:465
77FROM           = example@gmail.com
78USER           = example@gmail.com
79PASSWD         = ***
80MAILER_TYPE    = smtp
81IS_TLS_ENABLED = true
82HELO_HOSTNAME  = example.com
83```
84
85