"There was a problem sending the test email."

i’m just going through the Admin Quick Start Guide i’m at the step where i’m trying to send a test email, and getting this error:

There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again.

i’m with Mailgun. i thought it was working properly? i’ve used the “password reset” link from Discourse a few times, and it’s worked. i just checked the Mailgun logs, and i don’t see any failed or bounced emails. What else could be the issue?

The error message tell me to “verify your host is not blocking mail connections.” If it was, would those password reset emails even be working?


1 Like

Answering my own question… (i think…?)

In Mailgun, under Domains, i have the domain set as mail.mysite.com. i think it has to read discourse.mysite.com? Yes? No?

EDIT: Hmm. i’m not sure that’s it. When i look at Sent emails in my Discourse Admin panel, i see the four emails that were successfully sent (two forgot_password emails, two signup emails).

Update: i ripped through mailgun and added the domain rabbithole.lockquest.com instead of mail.lockquest.com, then updated all the DNS records.

Where do i tell that to Discourse? i’ve checked Admin>Settings>Email, and Admin>Emails. (And will that even fix the issue?)

That’s what you wanted to do!

That stuff isn’t in the web interface. Go back and run discourse-setup again and enter the new values.

1 Like
**Hostname      : rabbithole.lockquest.com**
**Email         : info@lockquest.com**
**SMTP address  : smtp.mailgun.org**
**SMTP port     : 587**
**SMTP username : postmaster@rabbithole.lockquest.com**
**SMTP password : [redacted]**
**Let's Encrypt : info@lockquest.com**

Does this all look correct?

i was more referring to a page which, maddeningly, i can no longer find, which said “if you want to send emails with Discourse, MAKE SURE this field says this,” and it had an image of the field with zero context, so i had no idea where to find it.

(test email still not working btw… not sure where to make adjustments?)

Looks OK.

Sometimes Digital Ocean blocks outgoing SMTP traffic. You can test with telnet SMTPSERVER 587 if it connects, that might not be the problem, but you probably don’t have telnet installed, so If mail’s not working, then re-run discourse-setup and use port 2525 instead of 587. Or, if you prefer pain, create a ticket, wait a day, and hope that they’ll unblock it for you.

Still no good. i submitted the ticket. :confused:

i asked DigitalOcean to unblock ports 587 and 2525. This was their response:

Thank you very much for getting in touch with us!
I can confirm that SMTP over IPv4 is not currently being filtered on your account.
Please keep in mind, however, that SMTP over IPv6 is not currently available.
Please let us know if you have any other questions!

Still can’t send a test email. What’s next?

If you are logged in as admin, did you check the /logs path in your web browser for errors related to the email sending?

I’ve had one install that couldn’t send to a self hosted mail server. It looked like the port was open (I could telnet there) but it never managed to send. I blamed it on their mail host.

I think the next thing is try it’s too delete that droplet and try a new one (or maybe try the new one first).

i tried telnet, and got this:

root@lockquest:/var/discourse# telnet smtp.mailgun.org 587
Connected to smtp.mailgun.org.

This is what the log said:

ActionController::RoutingError (No route matches [GET] “/sftp-config.json”)
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:63:in call'_ _Started GET "/deployment-config.json" for at 2018-01-18 12:26:42 +0000_ _ActionController::RoutingError (No route matches [GET] "/deployment-config.json")_ _/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:63:in call’
Started POST “/admin/email/test” for at 2018-01-18 12:35:55 +0000
Processing by Admin::EmailController#test as /
_ Parameters: {“email_address”=>“info@lockquest.com”}_
Sent mail to info@lockquest.com (1783.0ms)
Completed 422 Unprocessable Entity in 2048ms (Views: 0.5ms | ActiveRecord: 3.5ms)

Like i said, the attempt to send to info@lockquest.com doesn’t appear on my Mailgun logs.

This is what my TXT records look like:

i haven’t uncommented/recommented that noreply@ line in the .yml from this troubleshooting guide yet:


The rabbithole.lockquest.com status on Mailgun is green and active. Yes, they have my credit card number.

" Are you using an IP address as the mail domain?" i don’t know. Where do i check that?

Just looking at that image again, i see i’ve got k1._domainkey.rabbithole.lockquest.com, and krs._domainkey.mail.lockquest. Should it be k1 or krs? There must be two different pages/guides that each use one of these versions, because i wouldn’t know enough to invent one! :slight_smile:

UPDATE: i deleted the mail.lockquest.com domain from Mailgun, leaving only the rabbithole.lockquest.com domain there, and now the Forgot Password email from Discourse won’t send.

i DO see this in the logs:

Job exception: 535 5.7.0 Mailgun is not loving your login or password

Here’s the rest of the log in pastebin:


Anyone want to weigh in before i go eat this entire family-sized bag of Fritos by myself?

My guess is that you don’t have the right password set in your app.yml. Re-run it with the values that mailgun gives you.

1 Like

Of course … if i add a new domain to Mailgun, it’s gonna have its own distinct password.

i re-ran setup with the new password, and - huzzah! The Forgot Password email came through, but more importantly, the test email did too! So, so happy. Fritos go back in the cupboard. Onto the next debilitating stumbling block. :wink:

Thanks again, so much, for your help.