Help ›

Discourse forum email and reply by email with Microsoft 365

Discourse uses email to confirm new accounts, reset passwords, and send notifications and digests, and can also receive replies by email. It signs in to the mail server with a username and password, and has no OAuth option, so it can’t connect to Microsoft 365 or Gmail directly.

With Auth-Email, you change five lines in app.yml and rebuild Discourse.

đź’ˇ  Microsoft 365 and Gmail have daily sending limits, which a busy forum (especially one that sends digests) can reach. Check that the limits suit your forum’s size before switching.

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 Discourse – 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 995 for POP, wherever the examples show outlook.auth-email.com.


Step 1: Configure outgoing email

Edit the env section of your container configuration (usually /var/discourse/containers/app.yml):

  DISCOURSE_SMTP_ADDRESS: outlook.auth-email.com
  DISCOURSE_SMTP_PORT: 465
  DISCOURSE_SMTP_FORCE_TLS: true
  DISCOURSE_SMTP_USER_NAME: forum@yourdomain.com
  DISCOURSE_SMTP_PASSWORD: "your-auth-email-password"
  DISCOURSE_NOTIFICATION_EMAIL: forum@yourdomain.com
  • DISCOURSESMTPFORCE_TLS connects using SSL/TLS straight away, as Auth-Email expects on port 465. Remove any DISCOURSE_SMTP_ENABLE_START_TLS line
  • DISCOURSENOTIFICATIONEMAIL is the address that Discourse sends from. It must be the linked mailbox, or an address that the mailbox is allowed to send as

Then rebuild Discourse to apply the changes:

cd /var/discourse
./launcher rebuild app

To test, go to Admin > Email (/admin/email), and send a test email to yourself.


Step 2: Reply by email (optional)

To let people reply to notifications by email, link the mailbox that receives replies in Auth-Email. Then, in Admin > Settings, search for each of these settings:

  • reply by email enabled: Ticked
  • reply by email address: The linked mailbox, with plus addressing – for example, forum+%{reply_key}@yourdomain.com
  • pop3 polling enabled: Ticked
  • pop3 polling ssl: Ticked
  • pop3 polling host: outlook.auth-email.com
  • pop3 polling port: 995
  • pop3 polling username: The linked mailbox’s full email address
  • pop3 polling password: The password you chose in Auth-Email

Microsoft 365, Outlook, and Gmail all support plus addressing, so replies arrive in the linked mailbox.


Troubleshooting

  • “535 Authentication failed” in the email logs: check that the username is the full email address, and that the password is the one you chose in Auth-Email (not your mailbox password). Rebuild after any change to app.yml
  • Timeouts, or “wrong version number”: check that DISCOURSE_SMTP_FORCE_TLS: true is set with port 465, and that your server can make outgoing connections on that port
  • “Sender address rejected” or “SendAsDenied”:DISCOURSE_NOTIFICATION_EMAIL (and the notification email site setting, if it has been changed) must be 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 Discourse has connected, and explains any error it received. Still stuck? Email us – we’ll help you get it working.


Try Auth-Email with Discourse

Link your mailbox, update the SMTP settings in app.yml, and send a test email from the admin panel.

Start your free trial →

No credit card needed. Check that it works, including sending yourself test messages, before you pay.