简体   繁体   English

ssl 在 rails 6 中使用 devise 发送邮件时出错

[英]ssl erros sending mail using devise in rails 6

I am deploying rails 6 in production.我正在生产中部署 Rails 6。 I am testing the mail function of devise and I am getting this error我正在测试 devise 的邮件 function 并且收到此错误

OpenSSL::SSL::SSLError (hostname "localhost" does not match the server certificate):

how can I fix this?我怎样才能解决这个问题?

Thanks谢谢

The problem问题

If you encounter this problem when running Ruby on Rails:如果在 Rails 上运行 Ruby 时遇到这个问题:

OpenSSL::SSL::SSLError (hostname "localhost" does not match the server certificate) it is likely due to ActionMailer using the smtp as the delivery_method and your local mail server supporting TLS/SSL, but not having a correct/valid certificate. OpenSSL::SSL::SSLError (hostname "localhost" doesn't match the server certificate) 这可能是由于 ActionMailer 使用 smtp 作为投递证书,但没有正确的本地邮件/验证证书。

The solution解决方案

You can add a valid certificate, but if the server is just used for sending out mails, this may not be suited.您可以添加有效证书,但如果服务器仅用于发送邮件,则可能不适合。 In that case, you can change the delivery_method to sendmail, which makes ActionMailer use the sendmail binary directly.在这种情况下,您可以将 delivery_method 更改为 sendmail,这使得 ActionMailer 直接使用 sendmail 二进制文件。

source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM