Rails 腾讯发件箱配置错误求助:OpenSSL::SSL::SSLError (SSL_read: unexpected eof while reading)

512369179 · 2024年02月03日 · 最后由 hz_qiuyuanxin 回复于 2024年02月08日 · 441 次阅读

我在 rails7.0.4 项目中进行发件箱配置,使用的是 QQ 邮箱,配置如下:

config.action_mailer.smtp_settings = {
   address: "smtp.qq.com",
   port: "465",
   domain: "qq.com",
   user_name: "我的邮箱地址",
   password:  "我的密码",
   authentication: :plain,
   enable_starttls_auto: true,
   openssl_verify_mode: :none,
   ssl: true,
   tls: true
 }

提示错误如下: Error performing ActionMailer::MailDeliveryJob (Job ID: 19281785-f149-421b-9de4-c100a92e0b8f) from Async(default) in 466.54ms: OpenSSL::SSL::SSLError (SSL_read: unexpected eof while reading): /home/manmanlai/.rbenv/versions/3.1.2/lib/ruby/3.1.0/openssl/buffering.rb:214:in sysread_nonblock' /home/manmanlai/.rbenv/versions/3.1.2/lib/ruby/3.1.0/openssl/buffering.rb:214:inread_nonblock' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:218:in rbuf_fill' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:199:inreaduntil' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:209:in readline' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1057:inrecv_response' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1042:in block in getok' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1067:incritical' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1040:in getok' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1026:inquit' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:715:in do_finish' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:614:inensure in start' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:614:in start' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:109:instart_smtp_session' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb💯in deliver!' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/message.rb:2145:indo_delivery' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/message.rb:253:in block in deliver' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/actionmailer-7.0.4.2/lib/action_mailer/base.rb:588:inblock in deliver_mail' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:206:in block in instrument' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/notifications/instrumenter.rb:24:ininstrument' /home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:206:in `instrument'

配置换了好几波,都不成功,期待得到大牛的解答。

可以试试看这里边的配置:https://mini-geek.com/posts/32 。有段时间没验证了,按理说是能用的。

遇到过,换端口 587 解决了。

xeruzo 回复

试试 587 端口

需要 登录 后方可回复, 如果你还没有账号请 注册新账号