Troubleshooting email on a new Discourse install

You just installed Discourse via the install guide, but email doesn’t seem to work.

Unfortunately this means you can’t log in as an admin to finalize the install!

Let’s troubleshootize!

Test email working but activation mail not working
Email to verify new administrator not arriving
Test email not sending, 'completed 422 unprocessable entity' in production.log
Amazon SES not working with Discourse new install
JSON parse error when sending email with SparkPost
Did one-click install on Digital Ocean. Set up SMTP using SparkPost. Not receiving Discourse activation email
Can't get admin email to send working with using namecheap email server
To send email from you need to etc
Logs: Job Exception
What happens if you dont install email on Discourse
Local host as domain server?
Need Help - Discourse New Installation Forum Mail Not Working
Testing SMTP and watching logs?
Discoure with Amazon ses
Creating user without send out e-mail
Another 'cannot get smtp working' thread
New Discourse Instance, Email not working
[Self Hosted Install]
Trying to use googles SMTP
Discourse Setup - Not receiving activation email
DigitalOcean Mail
Not receiving activation email after registeration?
Emails suddenly stopped being sent
Continue Discourse Installation
Need Help - Discourse New Installation Forum Mail Not Working
Trouble configuring DNS
Discourse server failing to send email to the initial registered user
Discourse server failing to send email to the initial registered user
Hard time setting up the SMTP
Private self hosted smtp relay server setup?
Discourse & Amazon SES
Email configuration debugging
Not able to send mail from discourse server
How to install Discourse on $5 Droplet on DigitalOcean
E-Mail Sending dies not work
Granting Admin but email never arrives
I would like to test several users in a discourse
Internal Server Error 500 Error
Smtp and mailcow
Cannot get email working on new install
Set up some email
Not able to send emails - board offline until I can fix
Amazon SES: "Must issue a STARTTLS command first"
503 AUTH command used when not advertised
Testing SMTP and watching logs?
Can not configure my Bitnami Discourse instance to send out mails
Trouble getting the first email from Discourse
Am I missing anything?
Emails are being sent as localhost.localdomain
Unable Receive Activation Emails
Questions about using Discourse in a small (<10 people) community
Fresh install on VPS can't receive email
Is there a good information about Discourse configuration?
Service email not woking
Emails spontaneously broken
Error while rebuilding
Discourse forum sometimes loads with "Index of /" sometimes correctly with its signup/ login page
E-mail didn't delivered in the easyengine(nginx) proxy mandrill environment
Installing discourse and connecting it to cloudflare
Dont Get Activation Email When Signing Up
Don't receive activation email

Did you enter email settings correctly?

Double check the settings in your containers/app.yml file; the simplest way is to run ./discourse-setup again. A valid email section looks like this:


Double-check all values for correctness. Note that it all aligns, there are no leading # characters, and there are single quotes around the developer email field.

If you run ./discourse-doctor it will check several ways that your mail configuration might be broken.

If you had any errors in your app.yml and made changes , you MUST rebuild the container for those changes to take effect!

cd /var/discourse/
./launcher rebuild app

Are your SMTP connections being blocked?

To confirm that your server can indeed contact the email server, issue this command:

telnet 587

If you can’t connect this way, you’re almost certainly blocked. (And if you do get connected, the escape character for SMTP is ctrl+], then use quit to exit telnet.)

If this happens, contact your cloud provider support and confirm that your email connections are not being blocked.

What do the Discourse logs say?

From the command line, issue this command:

cd /var/discourse
tail shared/standalone/log/rails/production.log

This will show the last few lines of the log. Look for anything mail related. If you need to view the fuller logs, try

more shared/standalone/log/rails/production.log

To page through the complete log by pressing space. Look closely for any email related messages.

What do your email provider logs say?

Assuming there are no errors in the Discourse logs, or your Discourse mail configuration, the emails probably went out. The question, is what did your email provider do with them?

Most email providers have a log viewing function. Check the logs for your email domain and see what happened with the incoming emails.

Did you properly set up DKIM and SPF records for your domain?

You must enter those crucial DNS records for DKIM and SPF, otherwise your emails may arrive only sporadically, if at all.

Is the email domain correct?

The default email from address is based on the install domain plus subdomain, so if your URL is it will be:

But if your mail provider is expecting:

… you may have problems! To get around this, edit and uncomment this line in app.yml

## If you want to set the 'From' email address for your first registration, uncomment and change:
#- exec: rails r "SiteSetting.notification_email=''"
## After getting the first signup email, re-comment the line. It only needs to run once.

You’ll need to issue a rebuild after uncommenting the above line and setting the from email address as required.

You can also change this from the command line, if needed:

./launcher enter app
rails r "SiteSetting.notification_email = ''"

If you are using Mailgun, have you activated your domain and provided credit card information?

If you are using Mailgun, after you enter your DKIM and SPF records, you must visit and click the “Check DNS Records Now” button. At the top of that page you should see “State ACTIVE” (in a calming green). If it says “State Unverified” (in a scary warning-yellow) Mailgun will not accept mail.

Mailgun now requires a credit card in order to deliver mail (other than to you). If your mailgun logs have a message about “free accounts,” this is your problem.

Other mail services have similar requirements.

Are you using an IP address as the mail domain?

This does not work in our experience. You must use a domain name when sending email, not an IP address like

Need to log in without receiving an registration email?

We don’t recommend this, because your email is still broken, and you have a broken Discourse until email is working. But if you absolutely must log in as admin with email broken, here’s what to do:

cd /var/discourse
./launcher enter app
rake admin:create

And answer the prompts. It takes a few seconds before they appear. When it asks for the password, you will not be able to see what you type. That is why it makes you type it twice.

Email still doesn’t work! What next?

Anything else I forgot here? Feel free to edit this.


Just a few more links on sending an email through telnet:

  1. Easy-to-follow tutorial on how to authenticate with SMTP server from telnet:
    How to Test SMTP AUTH using Telnet

  2. How to send an email from telnet:

Followed these two and successfully sent an email with Mandrill SMTP.


I host my own MTA via Postfix; after installing Discourse it cannot send any email through my MTA. The reason is that when Discourse connects to send it announces SMTP HELO with “localhost.localdomain” and I have Postfix configured to reject obviously bogus hostnames.

It seems that Discourse should use the hostname from what I’ve defined in the Docker configuration (

But, with Postfix you can also configure the Discourse host to be more trusted by adding it to the my_networks option of Postfix - so that the invalid hostname on HELO can be ignored.

1 Like

I don’t think there’s a rake task, but you can run this in the rails console "")

Another option to manually check email deliverability in a more simplified way is to use Swiss Army Knife SMTP, the all-purpose smtp transaction tester (swaks) rather than telnet.

Example command:

swaks --to --from --server --auth LOGIN --auth-user -tls


19 posts were split to a new topic: Cannot get email working on new install

Easier than opening a ticket is using port 2525. I use it by default on my installs and never have a problem.


4 posts were split to a new topic: Can send email from command-line but not Discourse

It might be useful to add to the guide that a normal log for a sent message looks like this

Sent mail to **** (413.2ms) Rendering text template Rendered text template (0.0ms) Completed 200 OK in 576ms (Views: 0.9ms | ActiveRecord: 16.2ms)

… and If you still do not receive mail, check the “skipped” tab of admin-email settings, i.e /admin/email/skipped

In my case, AWS-SES was rejecting messages because my “reply by email” address was incorrect, which was apparent from the error message found on the skipped tab. There is a catch, however. Failed test messages do not show up in skipped. I was only able to see the error message because there were attempts to send digests that also failed for the same reason. I could find no record of the test message fails in /admin/email/. Maybe this is a bug.

Finally, when I finally do get the test message I get some helpful hints that I can only read after the problem is fixed. That template text should be in this guide, not a message you cannot read until you have found the fix.


In case it helps anyone here, this was the solve for an installation unable to get emails to deliver.
They wanted to use their CPanel server for outgoing mail and it just wasn’t working.

Cpanel gives you details like this:

Which led to an app.yml like this:


way too much hacking later and I got that working by doing this in the rails console.


:bulb: :blush: ok, so now I actually read up on the fun that is STARTTLS

The correct configuration is to use the scary looking NOT Recommended outgoing port of 587 (yes, the discourse default) and let STARTTLS do it’s thing.

Also, people often don’t know how to setup SSL on their shared cpanel servers for mail so you will likely experience certificate warnings which will also stop this from working.

Final settings needed:

#DISCOURSE_SMTP_PORT:                    # (optional, default 587)
#DISCOURSE_SMTP_ENABLE_START_TLS:         # (optional, default true)

Seems obvious but there was nothing in the logs that helped identify the reason for the problem other than it just doesn’t work.


thank you, this does the job.
I spend hours and hours with my own email server configured with TLS only on port 587.
struggling, no helpful log.
Finally, I added this parameter and it works :sunny:

By the way, rebuilding app takes so long, just for a small change of parameter value.
I wish it may exist a simpler way, without forcing rebuilding all but taking account of changes in settings : containers/app.yml

For a quick way to try different parameter without having to rebuild the app:

If you look at /var/discourse/shared/standalone/log/var-log, there are several files with a .txt suffix.
(for example, on my system I have MDJlYzAyNzY5NzcxOWY2.txt and a couple more)

If you grep /usr/bin/docker * in that directory you can see how the container is started.For me the command showed up in one of these .txt file (although I seem to remember seeing it in the syslog file the first I went looking for it.
Note that most of the parameters come directly from the containers/app.yml file.

I grabbed the command line and put it in a file. I can edit it, and start a container with different parameters to try things out (port mapping, hostname, SMTP parameters…)

That seems to work as long as you only change variables that are passed as arguments there.

For this to work, you need to stop the container if it is already running, and remove it. By default the container is called app.

docker stop app
docker rm app

Here’s what the command looks like for me (sensitive info replaced with xxx)
I saved it to a file I called and made the file executable (and added the stop and rm commands so I don’t forget)

/usr/bin/docker stop app
/usr/bin/docker rm app
/usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e DISCOURSE_HOSTNAME=xx.xx.xx -e DISCOURSE_DEVELOPER_EMAILS=xx@xx.xx.xx -e -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=xxx -e DISCOURSE_SMTP_PASSWORD=xxxxx -e DISCOURSE_SMTP_ENABLE_START_TLS=true -h lrose-app -e DOCKER_HOST_IP= --name app -t -p 8888:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address xxxxx local_discourse/app /sbin/boot
1 Like

For a quicker way, try:

./launcher destroy app
./launcher start app

I had properly the same problem

tail -f /var/discourse/shared/standalone/log/rails/production.log
Sent mail to (61113.9ms)
Job exception: Net::ReadTimeout

mentioned in

and here

as solution is on

maybe 465 works but there is a bug as described on

so verify username and password that they don’t begin with “Q” or “R”, using

5 posts were split to a new topic: Can’t get Siteground Email and one-click droplet to work


I am trying your solution but no success :frowning:
I have created the mail account (and also the discourse install) in a subdomain.

so it looks something like


I have changed the app.yml to the final settings you have supplied (commenting out the smtp_port anddiscourse_smtp_enable_start_tls and adding discourse_smtp_openssl_verify_mode:none.

But now I don’t know what do do.
the discourse-doctor says the email is sent but I never receive it. I have used and they too say it’s never received. But I don’t know what I have to change in Cpanel or (where do I need to change it??) to let it send my mail.

can anyone help?

At the bottom of app.yml is a commented out line that lets you set the notification address. You likely need to change it to whatever your mark server is configured for. You could check the mail server logs to see the error.

thank you @pfaffman :slight_smile:
to answer my own question (and maybe help others), problem was with the ‘no-reply’ email address that didn’t exist as a sender, and the server blocking those. I created a no-reply account and that fixed it.


With more shared/standalone/log/rails/production.log, I got to know the connection is getting refused to my admin mail address But that mail address is working absolutely fine because it is receiving mails from other mail clients while in Discourse installation even I am not receiving an activation mail. Also, my cloud server on DigitalOcean is getting through the email server with this telnet 465 but why the telnet connection with is not getting established?
I am using CPanel by the way. Kindly assist!!