2013-05-27 5 views
0

Я получаю сообщение об ошибке после того, как я пытаюсь отправить сообщение электронной почты с Завещания, через счет GMAILНеопределенный метод `default_ssl_context» для Net :: SMTP: Класс

«Неопределенный метод` default_ssl_context»для Net :: SMTP: Класс»

Это моя production.rb среда

require 'net/smtp' 
require 'tlsmail' 
require 'openssl' 

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE 
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) 

ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.perform_deliveries = true 
ActionMailer::Base.raise_delivery_errors = true 

ActionMailer::Base.smtp_settings = { 
    :enable_starttls_auto => true, 
    :address   => 'smtp.gmail.com', 
    :port    => 587, 
    :tls    => true, 
    :domain    => 'gmail.com', 
    :authentication  => :plain, 
    :user_name   => '[email protected]', 
    :password   => 'password' 

}

вы видели эту ошибку раньше? Благодаря

ответ

0

Я не знаю, почему у вас есть:

require 'net/smtp' 
require 'tlsmail' 
require 'openssl' 

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE 
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) 

ваш production.rb должен выглядеть следующим образом:

Portal::Application.configure do 

config.cache_classes = true 
    config.consider_all_requests_local  = false #Turn to true to get error log 
    config.action_controller.perform_caching = true 
    config.serve_static_assets = false 
    config.assets.compress = true 
    config.assets.compile = true 
    config.assets.digest = true 
    config.i18n.fallbacks = true 
    config.active_support.deprecation = :notify 

    #Defined SMTP options 
    #SMTP 
    config.action_mailer.default_url_options = { :host => 'portal.herokuapp.com' } 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.smtp_settings = { 
     :address    => 'smtp.gmail.com', 
     :port     => 587, 
     :domain    => 'gmail.com', 
     :user_name   => '[email protected]', 
     :password    => 'pass', 
     :authentication  => 'login', 
     :enable_starttls_auto => true 
    } 
end 
+0

Спасибо, но я получаю ошибку тайм-аута; Вот почему я использовал приведенные выше настройки -> Timeout :: Error (исполнение истекло): tlsmail (0.0.1) lib/net/smtp.rb: 454: in 'initialize ' tlsmail (0.0.1) lib/net/smtp.rb: 454: in 'open ' tlsmail (0.0.1) lib/net/smtp.rb: 454: in' block in do_start' tlsmail (0.0.1) lib/net/smtp.rb: 454: в 'do_start ' tlsmail (0.0.1) lib/net/smtp.rb: 440: в' start' mail (2.5.4) lib/mail/network/delivery_methods/smtp.rb: 112: в 'deliver! ' –

+0

@Nick_K что происходит, когда вы пытаетесь установить эту настройку – David

+0

Извините, я не объяснил себя правильно. Вот он: когда я пытаюсь выполнить мои настройки, я получаю «Undefined method' default_ssl_context »для Net :: SMTP: Class». Когда я пытаюсь выполнить настройки, я получаю ошибку TimeOut. –