Admin activation E-Mail not sent on fresh self-hosted install (ubuntu 20.04)

Hi Community,

I have a well runing self-hosted disourse install on a VPS with ubuntu 18.04 for about a year now. As the forum has grown, I started prepairing to switch to a more powerful VPS. So, I took a minimal ubuntu 20.04 image, applied some typical hardenings and installed discourse docker following the 30 mins install guide. I used the exact same values as for the well running install. But: the activation e-mail is not sent. The Troubleshooting email on a new Discourse install guide did not help - I can connect using telnet, but am getting the following error when running ./discourse-doctor:

>==================== MAIL TEST ====================
For a robust test, get an address from http //www mail-tester com/
Or just send a test message to yourself.
Email address for mail test? ('n' to skip) [anonymized]: test-9ymkghbvc@srv1 mail-tester com
Sending mail to test-9ymkghbvc@srv1.mail-tester com. . .
Testing sending to test-9ymkghbvc@srv1.mail-tester com using smtp mailbox org:587.
==================== ERROR ======================
                                    UNEXPECTED ERROR
>503 5.5.1 Error: authentication not enabled
>================== SOLUTION =====================
>This is not a common error. No recommended solution exists!
>Please report the exact error message above to https //meta discourse org/
(And a solution, if you find one!)

(had to strip off some pieces of the URLs above to be able to post here)

Strange fact: I get the same error when running ./discourse-doctor on my well running VPS as well, so I don’t know if the error is relevant.
As you see, I am using as email provider which works very well and is a great choice in terms of privacy and a robust email infrastructure setup. I have checked host and port and am usng this in Thunderbird an also in the other discourse install for years.

Any ideas? The only difference I see between both VPS is that the working one runs ubuntu 18.08 while the issue is on the VPS running ubuntu 20.04.

Thanks, cazee

1 Like

During your hardening, did you accidently block port 587?

Is there a type in your file?

smtp mailbox org:587

Should this be

smtp.mailbox org:587

Notice the dot.

1 Like

Thanks for your ideas.

Port 587 is open, I can connect to the smtp server with telnet as mentioned in troubleshooting guide.
Also tested with ufw disabled - same result.

No typo in yaml file - I removed these dots intentionally in my posting (new forum account - only 2 URLs allowed in a post).

Whats else can I ceck or do?

1 Like

Post code as proper code blocks, that’s why you ran into the problems you did.


I could solve this issue - finally.

The reason was the sender email address discourse uses by default. It is built from the hostname entered in setup (in my case something similar to resulting in the sender address which is rejected by the smtp server.

So, why do I use this non-friendly host name? Just because the server is meant to replace the existing one which is getting too small for our grown discourse community. I am preparing and testing the new server before switching DNS settings to point to this new server later on. Just want to save the time to create temp friendly DNS settings here.

How to fix the issue?
Search for these lines at the end of your app.yml:

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

Uncomment and adjust the last one to an address your smtp server accepts as a valid sender, e.g.
- exec: rails r "SiteSetting.notification_email='USER@DOMAIN.TLD'"

Now run ./launcher rebuild app to make the changes take affect and voilà - now the activation email is sent and you can activate the admin account and finish setup.

How did I find out?
I created a new mail account with my webspace provider and ran discourse setup again with these smtp credentials - and got the activation email as expected. So I knew it must have been related to the smtp settings (and not any other things related to the ubuntu / docker / discourse setup).
After activating the admin account with this other smtp server, I went to settings > email > skipped and found the failed attempts to send the activation email: 553 5.7.1 <>: Sender address rejected: not owned by user USER@DOMAIN.TLD

I would like to point attention of discourse dev team to the feature request Suggestion - allow optional system email “from” setting during setup. Please consider test installs (e.g. as a copy to run some tests prior to actual upgrade of an instance) not having a friendly host address. It would be so more smooth to set these up without havng to go to app.yaml. Also, in my opinion it is good to give the admin the choice to use email adresses not bound to the discourse host name.

Thanks :slight_smile:

Also thanks to @codinghorror for pointing me to look for how to post code blocks


I’m working on a change to discourse-setup that will require you to set the notification_email during the setup process. This should solve problems like yours going forward.


This is now merged and will be asked about on new installs!