# Use a self-signed cert with Discourse for emails

**URL:** https://meta.discourse.org/t/use-a-self-signed-cert-with-discourse-for-emails/32042
**Category:** Sysadmins
**Tags:** email, how-to
**Created:** [12.Август.2015 23:05:59 UTC](https://meta.discourse.org/t/use-a-self-signed-cert-with-discourse-for-emails/32042 "2015-08-12T23:05:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [12.Август.2015 23:05:59 UTC](https://meta.discourse.org/t/use-a-self-signed-cert-with-discourse-for-emails/32042/1 "2015-08-12T23:05:59Z")

</div>

Using a self-signed certificate with your SMTP and POP mail in Discourse is easy once you know how - here’s how!

_There is a condition, and that is that your hostname (main domain for server - usually the domain used for your name servers) allows your other domains to check email through it (usually via [mail.domain.com](http://mail.domain.com)). Most hosting panels allow this._

## Steps

- First create your self-signed certificate - just make sure your ‘web server hostname’ does not have http or www (so something like [yourdomain.com](http://yourdomain.com))

- Then upload the certificate (not the key!) to somewhere on your server, such as [yourmainsite.com/certs/8777373333.crt](http://yourmainsite.com/certs/8777373333.crt)

- Then add the following code to your app.yml:

```plaintext
run:
 - file:
     path: /tmp/add-cert
     chmod: +x
     contents: |
       #!/bin/bash -e
       #Download cert
       wget http://yourmainsite.com/certs/8777373333.crt -O - > /usr/local/share/ca-certificates/your-email-cert.crt
       update-ca-certificates

 - exec: "/tmp/add-cert"

```

(Change `http://yourmainsite.com/certs/8777373333.crt` to match your details)

- Then `./launcher rebuild app` to rebuild your app.

- Then in your admin control panel, make sure the `pop3 polling host` setting is just the hostname (so not [mail.domain.com](http://mail.domain.com), just [domain.com](http://domain.com)).

That’s it!!

If you need to trouble shoot:

`./launcher enter app`

Then `cd /etc/ssl/certs` and make sure your crt is there.

_Thanks to @riking for all his help in this 🙂_
