# Fresh Discourse/Docker install wont send mails

**URL:** <https://meta.discourse.org/t/fresh-discourse-docker-install-wont-send-mails/245255>\
**Category:** Self-hosting\
**Created:** [November 10, 2022, 10:31pm UTC](https://meta.discourse.org/t/fresh-discourse-docker-install-wont-send-mails/245255 "2022-11-10T22:31:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![funktionierbar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/funktionierbar/32/281388_2.png) [@funktionierbar](https://meta.discourse.org/u/funktionierbar)\
**Post date:** [November 10, 2022, 10:31pm UTC](https://meta.discourse.org/t/fresh-discourse-docker-install-wont-send-mails/245255/1 "2022-11-10T22:31:00Z")

</div>

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:

```plaintext
  DISCOURSE_SMTP_ADDRESS: mail.example.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: discourse@example.com
  DISCOURSE_SMTP_PASSWORD: "password"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
  #DISCOURSE_SMTP_DOMAIN: mail.example.com
  DISCOURSE_NOTIFICATION_EMAIL: discourse@example.com

```

when i run ./discourse-doctor i get:

```plaintext
==================== 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) [admin@example.com]: 
Sending mail to admin@example.com. . . 
Testing sending to admin@example.com using mail.example.com:587, username:discourse@example.com with plain auth.
 =======================================  
ERROR 
 ========================================
                                   UNEXPECTED ERROR

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

====================================== 
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!)

```

Being unable to find people with similar error messages on the web, I turned [to this thread](https://meta.discourse.org/t/troubleshoot-email-on-a-new-discourse-install/16326)  
I was easily able to connect to the mailserver with telnet from outside the container.

What I tried inside the container:

> getent hosts [mail.example.com](http://mail.example.com)

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

```plaintext
openssl s_client -connect mail.example.com:587 -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:
connect:errno=110

```

```plaintext
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:
connect:errno=99

```

```plaintext
 openssl s_client -connect smtp.gmail.com:587 -starttls smtp

```

works just fine  
When I try the

` openssl s_client -connect mail.example.com:587 -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?

---

_[View the full topic](https://meta.discourse.org/t/fresh-discourse-docker-install-wont-send-mails/245255)._
