【问题标题】:Rails Net::OpenTimeout - execution expired: when sending mailRails Net::OpenTimeout - 执行过期:发送邮件时
【发布时间】:2014-05-19 11:43:23
【问题描述】:

使用 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 之类的任何其他提供商,它可以正常工作,但在这种情况下,它只会显示此错误。

【问题讨论】:

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


【解决方案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
  }

【讨论】:

    猜你喜欢
    • 2014-12-10
    • 1970-01-01
    • 2013-07-24
    • 2019-09-01
    • 2020-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多