【问题标题】:SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol error in rails 4SSL_connect 返回=1 errno=0 state=SSLv2/v3 读取服务器你好 A:rails 4 中的未知协议错误
【发布时间】:2015-06-13 18:45:05
【问题描述】:

我正在为我的应用程序实施设计邮件,我已完成以下步骤:

在模型中:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable
end

然后我添加了confirmation_token、confirmed_at、 Confirmation_sent_at

在 devise.rb 中,我添加了:

  config.mailer_sender = 'example@gmail.com'

在 development.rb 中:

config.assets.raise_runtime_errors = true

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {
      :enable_starttls_auto => true,
      :address => 'smtp.gmail.com',
      :port => 587,
      :tls  => 'true',
      :domain => 'gmail.com',
      :authentication => :plain,
      :user_name => 'example@gmail.com',
      :password => '326272814example'
  }

当我点击忘记密码时,我收到如下错误:

OpenSSL::SSL::SSLError in Devise::PasswordsController#create

SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

通过一些链接,我补充说:

 :enable_starttls_auto => false,
  :openssl_verify_mode => 'none'

到 development.rb,但没有帮助我。请帮帮我

【问题讨论】:

    标签: ruby-on-rails devise


    【解决方案1】:

    我认为您的某些 smtp_settings 对于 gmail 不正确。试试

    config.action_mailer.smtp_settings = {
      address:              'smtp.gmail.com',
      port:                 587,
      domain:               'example.com',
      user_name:            '<username>',
      password:             '<password>',
      authentication:       'plain',
      enable_starttls_auto: true  }
    

    (来自http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail

    【讨论】:

    • 我收到错误534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbtMn
    • 来自serverfault.com/a/636989:尝试在您的 gmail 帐户中启用“访问不太安全的应用程序”。
    • 为应用程序创建一个特定的密码,这是一种更安全的方式。在此处了解如何操作:support.google.com/accounts/answer/185833?hl=en
    猜你喜欢
    • 2015-07-25
    • 2011-03-31
    • 2016-12-02
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 2019-04-03
    • 2015-11-01
    • 2011-05-30
    相关资源
    最近更新 更多