Fixing DigitalOcean’s one click Discourse install with Mailgun.

Recently, I discovered that DigitalOcean’s Discourse install is currently not quite ‘one-click’ (even if you follow all of the DigitalOcean and Mailgun instructions). For some reason, you just can’t get the admin confirmation email to send out of box.

Thankfully, I’ve found the solution.

First, try sending an email using ./discourse-doctor. I was getting rejects and a note that looks like this:

Failed: noreply@discourse.do.co → [MY EMAIL ADDRESS] ‘[Discourse] Email Deliverability Test’ Server response: 550 5.7.1 Unauthenticated email from do.co is not accepted due to domain’s DMARC 5.7.1 policy. Please contact the administrator of do.co domain if this was 5.7.1 a legitimate mail. Please visit 5.7.1 https://support.google.com/mail/answer/2451690 to learn about the 5.7.1 DMARC initiative. c4-v6si6756289pfa.285 — gsmtp

The problem, it turns out, is that DigitalOcean sets Discourse’s default notification email (according to the below helpful link):

https://meta.discourse.org/t/email-rejected-per-dmarc-policy-for-discourse-do-co/90772/5

This default causes all emails to not send, but in order to login and change this setting you need to confirm your admin email …. yikes.

Solution

Make a new account via command line using the following instructions from https://meta.discourse.org/t/create-admin-account-from-console/17274

Access Console
Connect to your Droplet via SSH, or use Putty 45 on Windows:
ssh root@192.168.1.1
Replace 192.168.1.1 with the IP address of your Droplet.
Switch to your Discourse folder:
cd /var/discourse
Enter the container:
./launcher enter app
Create New Account with Admin Privileges
Run this command from console:
rake admin:create
You will be asked for Email, Password and Confirm Password.
After providing required information a new account will be created with random username.
Now you will be asked: Do you want to grant Admin privileges to this account? (Y/n). Press enter to continue.

Now, login with your new email, change the following setting:

Try logging in as your original admin email and you’ll get a message prompting you to ‘resend activation email’. Hit that button and enjoy.

Hopefully this helped!