SSL with Email Server

Hey Guys, maybe you could help me. I have PostFix and Dovecot on the same server as my Apache2 website. My DNS is obviously Cloudflare. I have an MX record pointing from to, and I have an A record for to my server’s IP address. My problem is I set up my email server to use SSL/TSL and pointed it to the same .pem and .key files provided by Cloudflare that my website uses. When I change to DNS only, I lose the SSL/TSL and my mail server fails to connect to any clients like Thunderbird. Do I have to use a separate SSL key? This is my first time having my own mail server and I’m still pretty new to Cloudflare.

Unfortunately, mail server configuration is completely separate from Cloudflare. Especially when it comes to SSL/TLS. There’s zero overlap there…unless you’re on an Enterprise plan.

You’ll need to find another way to get SSL keys for mail services.


You can just use Letsencrypt to generate those cert. I used it for my site. Works great.

And yes, letsencrypt works with Postfix.

You can use this GitHub - acmesh-official/ A pure Unix shell script implementing ACME client protocol and use Cloudflare DNS provider.

The command looks like this

./ --issue -d --dns dns_cf --force --debug --log

Command for renew:

./ --renew -d --dns dns_cf --force --debug --log

Then you will have file in ~/ looks like this:

ls ~/
ca.cer                  fullchain.cer 

fullchain.cer is the cert that can be configured in Postfix and .key is the private key.

You will need to handle renew every 3 months. You can set a cronjob to do that. Instruction for Cloudflare API Key is at: dnsapi · acmesh-official/ Wiki · GitHub

Those can be run in a cronjob

1 Like

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