我在 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:in
read_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:in
readuntil'
/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:in
recv_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:in
critical'
/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:in
quit'
/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:in
ensure 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:in
start_smtp_session'
/home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rbin deliver!'
/home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/message.rb:2145:in
do_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:in
block 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:in
instrument'
/home/manmanlai/erp/api/shared/bundle/ruby/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:206:in `instrument'
配置换了好几波,都不成功,期待得到大牛的解答。