Mail Binding - OH3.3 - Cannot send Email -

Hi all,

I’m running OH 3.3.0 in docker on a QNAP NAS and I am struggling with sending emails. I’ve read through a lot of similar threads in the community but could not find an answer.

This is my test script:

val mailActions = getActions(“mail”,“mail:smtp:mymail”)
mailActions.sendMail(“myemailaddress-replaced”, “Text Subject”, “Text body”)

The mail:smtp:mymail Thing is configured with SSL/TLS, port 465 and all the right DNS name and credentials that I successfully use also for other applications on the NAS for email notification (but not in docker containers).

This is the error I get in the log:

2022-07-06 13:36:21.386 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: Could not connect to SMTP host: hostname-replaced, port: 465;
nested exception is: Received fatal alert: handshake_failure

I guess it’s a “stupid” communication problem between the OpenHAB container and the mail server. I would not think it’s a general firewall, etc. issue in my home network because many other applications can send emails successfully, even on the NAS.

Regarding the docker config (NAT configuration), I would not expect that I have to open port 465 in the docker config because it’s communication initiated inside the container to the outside. Or am I wrong? Any other obvious things I may be missing and would need to check or configure?

In all likelihood your OH instance and your mail server do not share an encryption algorithm in common. Review Docker Hub and pay attention to the CRYPTO_POLICY environment variable.

1 Like

Thanks so much, Rich, excellent hint! I had to set CRYPTO_POLICY from “limited” to “unlimited” and now it works!