How to enable inbound TLS(starttls) in Postfix with Signed Certificate from CA(LetsEncrypt)

Most of the time Postfix is configured with self signed certificate which works well because mostly certificate validation is not required by MTAs. Though it can be useful for applications or mailbox users connecting to central MTA to delivery of emails.

You can either buy SSL certificate from your provider or use free certificates(needs to be renewed every 3 months). In this guide, i will use letencrypt certificate for my mx host

I use letsencrypt utility to manage certificate for my domains, below command will generate standalone certificate for my host.

letsencrypt certonly --standalone -d

The output..

- Congratulations! Your certificate and chain have been saved at:
Your key file has been saved at:


vim /etc/postfix/

Replace the following lines :


to the following letsencrypt certificates path :


Reload postfix

systemctl reload postfix.service

You can verify certificate validation using See below test results after configuring for

Postfix inbound TLS with letsencrypt

How to enable Outbound Opportunistic TLS in Postfix

Most ISPs like Gmail, Hotmail and Yahoo now support Server-side-tls. ESPs like Sendgrid, Sparkpost, Mailchimp have also enabled outbound TLS in their MTAs.

You can either enforce Postfix to always use TLS or the other recommend way is to use ‘Opportunistic TLS’ so Postfix should use TLS when the recipient domain supports it otherwise falls back to non-TLS connection.

vim /etc/postfix/

Add after “smtp_banner” settings.

smtp_tls_security_level = may

Reload Postfix

systemctl reload postfix.service

Verify logs for errors.

tail -f /var/log/mail.log

Expected output:

Nov 26 13:21:54 console postfix/postfix-script[9285]: refreshing the Postfix mail system
Nov 26 13:21:54 console postfix/master[2323]: reload -- version 3.1.0, configuration /etc/postfix