Email setup


目录

Forgejo can be set to send emails such as a registration confirmation, either with Sendmail (or compatible MTAs like Postfix and msmtp) or by connecting to an SMTP server.

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 an email provider.

[mailer]
ENABLED        = true
FROM           = forgejo@example.com
PROTOCOL       = smtps
SMTP_ADDR      = mail.example.com
SMTP_PORT      = 465
USER           = forgejo@example.com
PASSWD         = `mysecurepassword`

Restart Forgejo for the configuration changes to take effect.

To send a test email to validate the settings, go to Forgejo > Site Administration > Configuration > SMTP Mailer Configuration.

To enable users to receive email notifications for pull requests or issues, you can set ENABLE_NOTIFY_MAIL=true in the configuration.

For the full list of options check the Config Cheat Sheet.

[!note] Note Authentication is only supported when the SMTP server communication is encrypted with TLS or HOST=localhost. This is due to protections imposed by the Go internal libraries against STRIPTLS attacks. TLS encryption can be through:

Using Sendmail

Use sendmail command as mailer.

[!note] Note For Internet-facing sites consult the 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.

[mailer]
ENABLED       = true
FROM          = forgejo@example.com
PROTOCOL      = sendmail
SENDMAIL_PATH = /usr/sbin/sendmail
SENDMAIL_ARGS = "--" ; most "sendmail" programs take options, "--" will prevent an email address being interpreted as an option.

版本号 #3
由 cocobook-sync 创建于 2026-10-28 16:40:59 UTC
由 cocobook-sync 更新于 2026-10-29 01:09:33 UTC