SMTP throws Handshake Failure on STARTTLS and implicit SSL

Hi!

I’ve been trying to set up my mailer on my instance. I am running it in docker via the official guide.
When attempting to connect to my SMTP host, I get the following messages in the log:

[notice] TLS :client: In state :wait_cert_cr at ssl_handshake.erl:2140 generated CLIENT ALERT: Fatal - Handshake Failure
{:bad_cert, :hostname_check_failed}

This is very likely related to E-Mails cannot be send when SMTP and STARTTLS is used (OTP26, OTP25 is fine)

I managed to work around the issue using this block in my SMTP configuration:

  tls_options: [
    verify: :verify_none
  ],

Still, it would be nifty if I could use SMTP while still properly verifying the certificates. There seems to be a fix (?) to the issue detailed here, but my Erlang knowledge is quite limited, therefore I do not quite know how to apply it…

1 Like