Gitea and Forgejo mailer settings for Microsoft 365 and Gmail
Gitea and Forgejo send email for registrations, password resets, and notifications about issues, pull requests, and reviews, and can read a mailbox to accept replies by email. Both sign in to the mail server with a username and password, and have no OAuth option, so they can’t connect to Microsoft 365 or Gmail directly.
With Auth-Email, you only need to change a few lines in app.ini.
Before you start: link the mailbox in your Auth-Email dashboard, and choose a password for it. That is the password you’ll enter in Gitea or Forgejo – not your mailbox password.
The examples below use an Outlook account. Show the server and ports for an account provided by Outlook: use outlook.auth-email.com, with port 465 for SMTP and 993 for IMAP, wherever the examples show outlook.auth-email.com.
Step 1: Configure outgoing email
Edit the [mailer] section of app.ini (usually /etc/gitea/app.ini, or custom/conf/app.ini):
[mailer]
ENABLED = true
PROTOCOL = smtps
SMTP_ADDR = outlook.auth-email.com
SMTP_PORT = 465
USER = git@yourdomain.com
PASSWD = `your-auth-email-password`
FROM = "Git Server" <git@yourdomain.com>
- PROTOCOL = smtps connects using SSL/TLS straight away, as Auth-Email expects on port 465
- PASSWD is wrapped in backticks, so that it can contain special characters
- FROM must use the linked mailbox, or an address that the mailbox is allowed to send as
If you run Gitea or Forgejo in Docker, you can set the same values with environment variables instead – for example, GITEA__mailer__PROTOCOL=smtps and GITEA__mailer__SMTP_ADDR=outlook.auth-email.com (Forgejo also accepts FORGEJO__mailer__…).
Restart the server. Then, as an administrator, go to Site Administration > Configuration (or Summary), and use Send Testing Email in the Mailer Configuration section.
💡 Gitea versions before 1.18 use different settings:
HOST = outlook.auth-email.com:465andIS_TLS_ENABLED = true, instead ofPROTOCOL,SMTP_ADDR, andSMTP_PORT.
Step 2: Reply by email (optional)
To let people reply to notification emails, link the mailbox that receives replies in Auth-Email, and add an [email.incoming] section to app.ini:
[email.incoming]
ENABLED = true
REPLY_TO_ADDRESS = git+%{token}@yourdomain.com
HOST = outlook.auth-email.com
PORT = 993
USE_TLS = true
USERNAME = git@yourdomain.com
PASSWORD = `your-auth-email-password`
REPLY_TO_ADDRESS uses plus addressing, which Microsoft 365, Outlook, and Gmail support, so replies arrive in the linked mailbox.
Troubleshooting
- “535 Authentication failed”: check that
USERis the full email address, and thatPASSWDis the one you chose in Auth-Email (not your mailbox password) - Timeouts, or “first record does not look like a TLS handshake”: check that
PROTOCOL = smtpsandSMTP_PORT = 465, and that the server can make outgoing connections on that port - “Sender address rejected” or “SendAsDenied”:
FROMmust use the linked mailbox, or an address that the mailbox is allowed to send as
For other errors, such as Microsoft 365 reporting that SMTP AUTH is disabled, see fixing common errors. Your account’s connection page in the Auth-Email dashboard also shows whether Gitea or Forgejo has connected, and explains any error it received. Still stuck? Email us – we’ll help you get it working.
Related articles
Try Auth-Email with Gitea or Forgejo
Link your mailbox, update the mailer section of app.ini, and send a testing email.
Start your free trial →No credit card needed. Check that it works, including sending yourself test messages, before you pay.