I’m self-hosting my Discourse forum on Yunohost, and I ran into an issue with the SMTP email configuration. After scouring the meta.discourse documentation, I couldn’t find any information on Yunohost’s specific operations or save locations. I uninstalled and reinstalled Discourse, copied the log file, and finally located the configuration file that contained the SMTP information.
If you’re also using Yunohost and need to configure your Discourse SMTP settings, you can find the file you’re going to modify at
/var/www/discourse/config/discourse.conf.
Open that file, configure the SMTP settings, save and exit, and then restart Discourse with the command “systemctl restart discourse”.
root@yuno:~# nano /var/www/discourse/config/discourse.conf
root@yuno:~# systemctl restart discourse
And if it helps anyone else, because also, I couldn’t find information -
To configure Discourse with your Office365 you’ve got to do the following:
- Go to your Microsoft 365 admin center
- Click on Settings then Domains
- Click on Add Domain
- Follow the instructions on the screen to add your forum’s URL
- Once you’ve completed the above steps and the DNS is verified, you’re now able to create an inbox using that subdomain
- Click on Users and then Active users
- Click on Add a user
- Create the mailbox for your forum (example: noreply@forum.yourlinks.com) mailbox domain must match the hostname from where the forum runs
- Click on Licenses & Apps
- Assign this mailbox an Exchange Online (Plan 1) license (10,000 messages daily 30msg/min throttle) It is required to have a license attached to the mailbox for the purpose of direct-delivery. At the time of writing, the cost is $4.00USD/mo or $5.10/CAD | Should you require a higher limit or a shorter throttle, there are other plans available
- Click on Mail and then Manage email apps
- Enable “Authenticated SMTP”
- Click Save changes
- Go to your Azure portal
- Browse to your active directory
- Select Properties in the left sidebar, right under User settings
- Select Manage security defaults
- Set Security defaults to “disabled”
- Click save
- Go back to Users > Active users
- Click on Multi-factor authentication
- Disable MFA on the mailbox being used
Now as far as Office365/Microsoft365 is concerned, your newly created mailbox is now ready to direct send on behalf of your Discourse instance.
Settings to use the Office365 mailbox:
modify these lines in /var/www/discourse/config/discourse.conf
# hostname running the forum
hostname = "forum.yourlinks.com"
# backup hostname mainly for cdn use
backup_hostname =
# address of smtp server used to send emails
smtp_address = smtp.office365.com
# port of smtp server used to send emails
smtp_port = 587
# domain passed to smtp server
smtp_domain = forum.yourlinks.com
# username for smtp server
smtp_user_name = noreply@forum.yourlinks.com
# password for smtp server
smtp_password = YourLinksPassWordHere
# smtp authentication mechanism
smtp_authentication = login
# enable TLS encryption for smtp connections
smtp_enable_start_tls = true
# mode for verifying smtp server certificates
# to disable, set to 'none'
smtp_openssl_verify_mode =
# force implicit TLS as per RFC 8314 3.3
smtp_force_tls = false
# load MiniProfiler in production, to be used by developers
load_mini_profiler = false
# hostname running the forum
hostname = "forum.yourlinks.com"