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

**URL:** https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568
**Category:** Self-hosting
**Created:** [December 18, 2018, 4:06pm UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568 "2018-12-18T16:06:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dun](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@dun](https://meta.discourse.org/u/dun)
#### Post date: [December 18, 2018, 4:06pm UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568/1 "2018-12-18T16:06:32Z")

</div>

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 setup.sh, 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:**  

2. **Discourse** I installed Discourse by following the [**Beginner Docker install guide**](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md).  
I ran discourse-setup and entered the following data:

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

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

Sent mail to dun@domain.com (69.5ms)
Job exception: hostname "domain.com" does not match the server certificate

Sent mail to dun@domain.com (61.3ms)
Job exception: hostname "domain.com" does not match the server certificate

Sent mail to dun@domain.com (22.8ms)
Job exception: hostname "domain.com" 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?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 18, 2018, 6:14pm UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568/2 "2018-12-18T18:14:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dun](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@dun](https://meta.discourse.org/u/dun)
#### Post date: [December 20, 2018, 8:31am UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568/3 "2018-12-20T08:31:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 11, 2021, 7:05am UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568/4 "2021-11-11T07:05:53Z")

</div>



---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [November 11, 2021, 10:49am UTC](https://meta.discourse.org/t/hostname-doesnt-match-server-certificate-lets-encrypt/104568/5 "2021-11-11T10:49:34Z")

</div>


