Fresh Discourse/Docker install wont send mails

Hi people,
I want to switch a long standing forum from phpBB3 to Discourse. I managed to setup the Docker, and am able to access the Initial Setup. Unfortunately there is no mail being sent, so i can’t finish the init.
I did some debugging and cant find the reason, so I am turning to you for help.

My setup is like this, I have setup apache2 as a reverseproxy to the docker, which works. My mailserver is a mailcow docker on the same machine. The mailserver is tested thoroughly and works fine on a daily basis through SMTP with STARTTLS on Port 587 and webmail.

the config in my app.yml looks like this:

  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

when i run ./discourse-doctor i get:

==================== MAIL TEST ====================
For a robust test, get an address from
Or just send a test message to yourself.
Email address for mail test? ('n' to skip) []: 
Sending mail to . . 
Testing sending to using, with plain auth.
                                   UNEXPECTED ERROR

Cannot assign requested address - connect(2) for [correct ipv6]:587

This is not a common error. No recommended solution exists!

Please report the exact error message above to
(And a solution, if you find one!)

Being unable to find people with similar error messages on the web, I turned to this thread
I was easily able to connect to the mailserver with telnet from outside the container.

What I tried inside the container:

getent hosts

provided the correct IPv6 Adress
But then the errors started turning up:

openssl s_client -connect -starttls smtp
140124593714496:error:0200206E:system library:connect:Connection timed out:../crypto/bio/b_sock2.c:110:
140124593714496:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111:
openssl s_client -6 -connect "[correct IPv6]:587" -starttls smtp
139918557709632:error:02002063:system library:connect:Cannot assign requested address:../crypto/bio/b_sock2.c:110:
139918557709632:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111:
 openssl s_client -connect -starttls smtp

works just fine
When I try the

openssl s_client -connect -starttls smtp

from outside the container, It works also fine.
My mailcow/postfix logs show nothing…
I am stumped. Can you help me where to look next?

1 Like

See Troubleshoot email on a new Discourse install.

The issue is probably that your notification email address is not one that you have configured your mark server to send from.

But that doesn’t explain the “connection timed out” errors. That sounds like some docker network issue.

1 Like

thank you for your reply. I tried using the same adress in both fields, no change, same error.
Following the Troubleshooting thread:

What do the Discourse logs say?

`Job exception: Cannot assign requested address - connect(2) for [correct IPv6]:587

What do your email provider logs say?

No log entries show up relating to mails sent from discourse.

I then tried this Method to see if I would be able to authenticate through openssl, and it works fine from the server, but not from inside the container, it produces the error I described in the first post.

How can I find out what is blocking the connection here?

1 Like

omfg it was so easy.
I just had to activate IPv6 in my Docker network, just the first three steps in this tutorial and it worked.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.