Rails Net :: OpenTimeout - 执行过期:发送邮件时

时间:2014-04-07 09:49:14

标签: ruby-on-rails ruby-on-rails-3 smtp sendmail actionmailer

使用 ActionMailer 在Rails中发送邮件时出现以下错误:

Completed 500 Internal Server Error in 5222.3ms

OpenSSL::SSL::SSLError - SSL_read: wrong version number:

我在development.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天了。任何帮助,将不胜感激。 here是完整的堆栈跟踪

修改

mail gem => actionmailer(3.2.17)

Settings.mail.alerts => 'alerts@xyz.in'

如果我使用像gmail这样的任何其他提供商它工作正常但在这种情况下只显示此错误。

1 个答案:

答案 0 :(得分:1)

添加配置:

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
  }
相关问题