How do I set the SSL protocol needed for ActionMailer to use a TLS connection?

前端 未结 1 1571
眼角桃花
眼角桃花 2021-01-15 22:12

I am running into an issue trying to use my campus\'s SMTP server with my Rails 5.x app. I receive the following error: SSL_connect returned=1 errno=0 state=SSLv2/v3 read se

相关标签:
1条回答
  • 2021-01-15 22:21
    port:                 587,
    ...
    tls:                  true,
    enable_starttls_auto: true
    

    According to the documentation ":ssl/:tls - Enables the SMTP connection to use SMTP/TLS (SMTPS: SMTP over direct TLS connection)". But port 587 is not for direct TLS but for TLS upgrade via the STARTTLS command. Direct TLS is done on port 465 instead if enabled.

    Thus, your client tries to access a non-TLS connection with TLS and this results in this strange error. See also my explanation on a similar question where this happened with Perl not Ruby.

    To solve the problem either use port 465 with tls (if enabled on the server) or use port 587 and rely on enable_starttls_auto that it will do a later upgrade to TLS.

    0 讨论(0)
提交回复
热议问题