SMTP server connects, mail fails to send

==================== MAIL TEST ====================
For a robust test, get an address from
Sending mail to REDACTED  . . 
Testing sending to using
SMTP server connection successful.
Sending to . . 
Sending mail failed.

==================== DONE! ====================

And I do not get the activation email for setting up account

Any help is appreciated :stuck_out_tongue_closed_eyes:

1 Like

My guess is that your forum is called and is sending from and your mail server won’t do it. There is a line at the bottom of app.yml that you can change to set the address. You have to edit it by hand.


Can you explain more in detail, my site is located at and the email is, my app.yml Config looks fine

1 Like
## Any custom commands to run after building
  - exec: echo "Beginning of custom commands"
  ## 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.
  - exec: rails r "SiteSetting.notification_email=''"
  - exec: echo "End of custom commands"

I have made sure the lines are uncommented and the email is correct now and I have rebuilt the container but I still receive no verification email

1 Like

Sorry. That was my best guess.


So, what do I need to do? I can give you access to the server if needed to help me!

Sorry. I’ve done my best here and have no more ideas.

If you want me to solve your problem, then you can see my installation packages: Discourse Installation Packages — Literate Computing, LLC.

I can configure Mailgun for you and it will work. There are a hundred different things that might be causing your custom mail server not to work.

Well, I don’t want to reconfigure my mail stuff with my domain and don’t want to be spending more money for mailgun


You’d not need to change any of your existing mail stuff and Mailgun is free for the first 10K messages/month.

1 Like

Hi everyone,
Did anyone find a solution to this?
I’ve setup postfix on my docker host for outgoing emails. It works fine when I send emails from ssh via the mail command, but discourse docker is failing with the same error as the OP got. I’ve used a hint from this thread: How to set SMTP config to use localhost? and thanks to that I got rid of authentication error from discourse docker (I do not provide any user/password to discourse docker to connect to my email server) , but now getting ‘sending mail failed’. Any ideas?

I had no idea that setting up an email server would be the hardest part in my discourse journey… :frowning: The discourse install is just flawless and so well thought unlike any linux email server setup.

Thanks in advance!

1 Like

That’s why all of the installation instructions say not to try to do it. Running a mail server is very hard now.

My guess is that Discourse is using the hostname for the email address that it sends from and your mail server won’t send it. But there are dozens of things that could be wrong.,all of which are beyond the scope of the help you can get here.


For those people seeking solution to this - I’ve solved it - this post was crucial here:

The problem was that Discourse was unable to connect to my postfix server from docker. Technically the connection comes from another network and postfix did not have this network on the list of allowed networks. It’s enough to add docker network (in my case to mynetworks in postfix config and then it works!
You first need to check if docker can connect to your postfix in the first place (I mean if the connection can be made before the allowed network check is executed in postfix). Remember to check postfix’s config in inet_interfaces. I assigned all because localhost won’t work for Discourse in docker.
If it still doesn’t work - please check postfix logs. In my case they are in /var/log/mail.log file.

Hope this will help somebody in the future. It took me long days to get it up and running, but now I finally don’t rely on any paid mailing service (I even wanted to, but I couldn’t make it work) and have it for free (remember to add SPF records to your domain! as otherwise Gmail and other mail providers will block your emails - they won’t even go to SPAM, but will be undelivered)