Discourse on Yunohost: SMTP Configuration Tips
As a tinkerer and hobbyist, I love exploring all sorts of tech-related things. Recently, I decided to try my hand at self-hosting a Discourse forum on Yunohost. While it was an exciting endeavor, I did run into a few issues along the way.
One such issue was with the SMTP email configuration, which I couldn’t seem to find any information on in the meta.discourse or documentation. After a bit of trial and error, I finally found the solution, and I thought it would be helpful to share my experience with other Yunohost users out there.
Finding the Discourse.conf file:
If you’re using Yunohost and need to configure your Discourse SMTP settings, the file you’re looking for is /var/www/discourse/config/discourse.conf. However, it took me quite some time to locate this file since there wasn’t much documentation on it. But don’t worry, I’ve got you covered.
Once you’ve located the file, you’ll need to open it up and configure the SMTP settings. Once you’re done, simply save the changes and exit the file, and then restart Discourse with the command “systemctl restart discourse”. Here’s an example of what the commands would look like:
root@yuno:~# nano /var/www/discourse/config/discourse.conf
root@yuno:~# systemctl restart discourse
Configuring Discourse with Office365:
- Go to admin.microsoft.com
- Click on Settings then Domains
- Click on Add Domain
- Follow the instructions on the screen to add your forum’s URL (example: forum:yourlinks.com)
- 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
Finally, you’ll need to configure Discourse to use your Office365 mailbox. Here are the settings you’ll need to use:
# 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
And that’s it! You’re done. What took me all morning, shouldn’t take you more than 20 minutes.