Question

How to set up mail server or SMTP account properly for Discourse?

I have been trying to set up Discourse for a few days now and I can’t find what is causing Discourse not being able to send email to the mail account I provided to be the admin. I have tried setting up Postfix, also using zoho mail (which works for my other websites), mailgun (which seems everything is okay on their website but doesn’t work when I sign up for the admin account). Am I forgetting something?

P.S. I am not really experienced about mail servers.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I was having the same problem for days, support doesn’t help, but your solution works as a charm, Thanks a lot!

What did you end up using? Did you setup Zoho for the mails? I’m having a similar issue, and have already set up the DKIM and SPF for the domain.

The discourse forum is setup in one of my sub domains in a different droplet. Do I have to set up DKIM and SPF for the sub domain as well? I tried sending test emails using Discourse but it doesn’t work.

The log message states “Sent mail to something@gmail.com (1329.1ms) Completed 422 Unprocessable Entity in 1451m”

@yanechednezzar

If there’s a connection attempt, there should be some sort of a log stating whether that attempt was successful or whether it failed (at the mail provider – either through their CP or otherwise).

Even if there’s not, there should be some sort of log, somewhere, that details what is causing mail not to go through, or causing it to fail to send.

Have you checked your error logs? You can check /var/log and run a command such as:

tail -20 /var/log/LOGFILE

Where LOGFILE is the name of the log file you wish to get output from. The above command will allow you to echo out the last 20 lines of the log. You can, of course, swap 20 out with 50, 100, etc, though normally and in most cases, the last 20 lines are enough.

Beyond that, you may wish to check and see if there’s an error log being stored for Discourse and also scan it to see if there’s something being logged. If it fails and there’s no log anywhere, that’s a major issue as something beyond mail service is probably an issue.

It could be something small, or it could be an actual issues which you’d need to report to the devs.

With that being said, how did you setup Discourse? If you’ll let me know how, I’ll run it on a tester Droplet of mine and see if I can replicate the issue.