Hostname doesn't match server certificate (Let's Encrypt)

Hi, I have a problem with receiving the activation mail after Discourse was installed.

My process:

I currently have no mailserver so I wanted to run mailserver and Discourse on the same machine. I decided to use docker-mailserver. I’ve ordered a VPS from a German provider and I’m using a Namecheap domain I wasn’t using anymore.
Because I don’t want this domain to be public I switched it with “domain. com” below. I hope that’s ok.

  1. Mailserver: I installed the mailserver, created some mail addresses with, generated dkim and created a TXT record for it at my DNS provider. I tested the addresses with Thunderbird and I was able to send and receive mails without any problem. Telnet also returns 220 so everything seems to be ok.
    Here is screenshot of the DNS records:

    SSL-Tools result:

  2. Discourse I installed Discourse by following the Beginner Docker install guide .
    I ran discourse-setup and entered the following data:

    Hostname      :
    Email         :
    SMTP address  :
    SMTP port     : 587
    SMTP username :
    SMTP password : ABCDEFG123

Then I proceeded to send the activation link to dun@domain. com but it never arrived.

dun@server:~$ tail /var/discourse/shared/standalone/log/rails/production.log 

Sent mail to (69.5ms)
Job exception: hostname "" does not match the server certificate

Sent mail to (61.3ms)
Job exception: hostname "" does not match the server certificate

Sent mail to (22.8ms)
Job exception: hostname "" does not match the server certificate

I don’t fully understand what this means because this is the first time I’m configuring TLS. I guess it’s because I’m using a different certificate for the mailserver. How could I use the same certificate for both containers?

This is an issue with the mail server certificate. You can probably get one with Let’s Encrypt, but it’s not a problem with Discourse, so ask for help from the docker-mailserver people. If you want people to receive your mail and not to spend a long long time getting your mail server trusted, you’ll be better off using a mail service like Mailgun.

1 Like

Thanks for your reply.
I guess I understand it a little bit better now. With my configuration Discourse already created the LE certificate while installing. The next step to get this running would be using that certificate on my mailserver which seems to be kinda tricky. At least I didn’t found anyone mentioning a process like this. I searched for pem files in the Docker VM and found them in /etc/ssl/certs and in ruby-folders under /usr/local/lib and /var/www/discourse/vendor. But I don’t really know if I could just copy them to the virtual machine that’s running the mailserver.

So the conclusion is, that it’s not possible to make this setup run without having more knowledge about TLS.