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.

email-setup.en-us.md 2.8KB

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