If you're having mail rejected saying it's coming from noreply@discourse.do.co or you're wondering why dmarc isn't set up, this article may help.

You may have noticed, or may not have, that comments are once again available on my blog. If you scroll all the way to the bottom of any entry, you'll see a comments section.

Discourse Blog Comments Now Available

I decided not to use Disqus anymore as they were hacked, and I'd kind of rather have something I install and maintain anyway.

In its place, I opted for a self-hosted DigitalOcean One-click Discourse server.

Discourse One-click App Server on DigitalOcean

Couldn't be easier right?

Not so fast sports fans!

I set my server up to use Mailgun as the mail server. It was one of the vendors recommended for this in both Discourses installation documentation and the DigitalOcean Discourse One-click App deployment guide.

First, I deployed the Discourse server, did some security stuff, and left it for the time being. I plugged its IP Address into NameCheap for a new subdomain that would be hosting the forum server.

Then I signed up for a Mailgun account with that newly acquired information.

The information I needed to properly set up and integrate Mailgun with NameCheap was not clearly provided up front. It took a few tickets with Mailgun to get what was needed. I'm hooking you up to save you some time with the table below.

Purpose Type Host Value Preference
SPF TXT mg.<your subdomain> v=spf1 include:mailgun.org ~all N/A
DKIM TXT mx._domainkey.mg.<your subdomain> k=rsa;p=<mailgun string> N/A
MX MX mxa.mailgun.org mxa.mailgun.org 10
MX MX mxb.mailgun.org mxb.mailgun.org 10
CNAME CNAME email.mg.<yoursubdomain> mailgun.org N/A
DMARC TXT _dmarc v=DMARC1; p=quarantine; rua=mailto:reports@<your domain> N/A

I can't tell you those values will reflect what you'll be inputting with your DNS provider, but you'll have something to look for in the documentation provided or ask for from support.

I had one out of three people I was working with at Mailgun try to just refer me back to my DNS provider. The others were extremely helpful and responded in less than 24 hours.

One other piece that will cause you headaches is a nonsensical default in a field called notification email in the Admin console.

I was doing email testing and my registration emails kept getting bounced by my email providers because the emails had a from address of noreply@discourse.do.co.

I couldn't figure out where that was coming from, because nowhere in the setup process did I enter that or have it presented as a default.

Finally, after searching around quite a bit, I found it. in the Admin interface, under Settings, Required, there's a notification email dialogue box. Replace noreply@discourse.do.co with a desired email address from the domain you set up for Mailgun. Remember to click on the green check mark to save.

Change this in Discourse to an email address on your domain

After doing all this, I came across a blog post by Andrew Kuznetsov describing the noreply@discourse.do.co piece. His situation was a little worse than mine as he was not able to log into his Discourse server's web interface until he took some actions.

I'll be reaching out to DigitalOcean to see if I can have that added to the setup process, or better yet, changed in the one-click image.

It seems running sudo ./discourse-setup from your /var/discourse directory will do a bunch of good stuff for you, including set up SSL for your server with a free Let's Encrypt certificate.

You'll also get a mixed content message in your browser after enabling SSL until you set Discourse to force HTTPS.

Discourse - Force HTTPS

For me, this was visible in the Dashboard. If it isn't for you, you can find it under Settings, Security.

You'll get a warning about making sure all your content will be served over HTTPS. If this is a new install, checking the box should not cause you any issues.

I hope you found this helpful.

The rest of what you need should be available at DigitalOcean, Discourse, and Mailgun, assuming you're using each of those.