使用 ActionMailer 在 Rails 中发送邮件时,出现以下错误:
Completed 500 Internal Server Error in 5222.3ms
OpenSSL::SSL::SSLError - SSL_read: wrong version number:
我在开发中的设置.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
ActionMailer::Base.default :from => Settings.mail.alerts
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.live.com",
:port => 587,
:domain => "xyz.in",
:user_name => "alerts@xyz.in",
:password => "my_password",
:authentication => "plain",
:enable_starttls_auto => true
}
我在这个问题上停留了 4 天。任何帮助将不胜感激。这是完整的堆栈跟踪
编辑
邮件 gem => 操作邮件程序 (3.2.17)
Settings.mail.alerts => 'alerts@xyz.in'
如果我使用任何其他提供商,例如gmail,它工作正常,但在这种情况下,只有它显示此错误。
添加配置:
ssl: true
测试:
config.action_mailer.smtp_settings = {
:address => "smtp.live.com",
:port => 587,
:domain => "xyz.in",
:user_name => "alerts@xyz.in",
:password => "my_password",
:authentication => "plain",
:enable_starttls_auto => true,
:ssl => true
}