Ssmtp & Let’s Encrypt

The issue I had was related to sending emails from my mid to my back server (mail & database) since I configured SMTP with Let’s Encrypt certificate.

With debug the error is:
SSL not working: certificate verify failed (20)

When I checked the certificate, I had :

openssl s_client -connect smtp.xxx.fr:587 -starttls smtp -servername smtp.xxx.fr
CONNECTED(00000003)
depth=0 CN = smtp.xxx.fr
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = smtp.xxx.fr
verify error:num=21:unable to verify the first certificate
verify return:1

The solution I found is

copy into /etc/pki/ca-trust/source/anchors the Let’s Encrypt fullchain certificate (chain.pem)
And do an update-ca-trust extract

Error solved !