RoR - Devise Mailer - 拒绝发送消息的Gmail

时间:2015-04-28 21:11:13

标签: ruby-on-rails ruby-on-rails-3 devise gmail

目前我正在开发Cloud9并尝试创建一个rails应用程序,其中Devise邮件程序可以发送重置密码功能和其他内置邮件功能。

我认为正在发生的事情是,由于该帐户,gmail拒绝发送邮件。我甚至去了gmail,发现了发送请求的cloud9服务器并检查了#34;这是我"对于IP地址......但它仍然没有工作

我尝试过:

  1. http://support.google.com/mail/bin/answer.py?hl=en&answer=14257&p=client_login此链接允许您的帐户接收来自"不太安全的消息请求"的应用程序。
  2. 更改端口号 - 然后我们得到超时错误而不是当前错误。
  3. 尝试了雅虎帐户 - 类似错误
  4. 另请注意,端口25,587和465已从Cloud9阻止到外部。
  5. 相关文件:

    日志/ development.log:

    Devise::Mailer#reset_password_instructions: processed outbound mail in 646.5ms
    
    Sent mail to joeShmoe@gmail.com (60.6ms)
    Date: Tue, 28 Apr 2015 20:32:39 +0000
    From: coolEmail@gmail.com
    Reply-To: coolEmail@gmail.com
    To: joeShmoe@gmail.com
    Message-ID: <553fee678a275_4542521a93097522@myAcct-1298669.mail>
    Subject: Reset password instructions
    Mime-Version: 1.0
    Content-Type: text/html;
     charset=UTF-8
    Content-Transfer-Encoding: 7bit
    
    <p>Hello joeShmoe@gmail.com!</p>
    
    <p>Someone has requested a link to change your password. You can do this through the link below.</p>
    
    <p><a href="http://localhost:3000/profile/users/password/edit?    reset_password_token=VhJFo7yaAsL3tCg2U4Tm">Change my password</a></p>
    
    <p>If you didn't request this, please ignore this email.</p>
    <p>Your password won't change until you access the link above and create a new one.</p>
    
        Completed 500 Internal Server Error in 32108ms
    
    Net::OpenTimeout (execution expired):
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:541:in `open'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/timeout.rb:101:in `call'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:520:in `start'
        mail (2.6.3) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
        mail (2.6.3) lib/mail/message.rb:2141:in `do_delivery'
        mail (2.6.3) lib/mail/message.rb:236:in `block in deliver'
        actionmailer (4.1.6) lib/action_mailer/base.rb:527:in `block in deliver_mail'
        activesupport (4.1.6) lib/active_support/notifications.rb:159:in `block in instrument'
        activesupport (4.1.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
        activesupport (4.1.6) lib/active_support/notifications.rb:159:in `instrument'
        actionmailer (4.1.6) lib/action_mailer/base.rb:525:in `deliver_mail'
        mail (2.6.3) lib/mail/message.rb:236:in `deliver'
        devise (3.4.1) lib/devise/models/authenticatable.rb:178:in `send_devise_notification'
        devise (3.4.1) lib/devise/models/recoverable.rb:99:in `send_reset_password_instructions_notification'
        devise (3.4.1) lib/devise/models/recoverable.rb:49:in `send_reset_password_instructions'
        devise (3.4.1) lib/devise/models/recoverable.rb:116:in `send_reset_password_instructions'
        devise (3.4.1) app/controllers/devise/passwords_controller.rb:13:in `create'
        actionpack (4.1.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
        actionpack (4.1.6) lib/abstract_controller/base.rb:189:in `process_action'
        actionpack (4.1.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
        actionpack (4.1.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
        activesupport (4.1.6) lib/active_support/callbacks.rb:113:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:113:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
        activesupport (4.1.6) lib/active_support/callbacks.rb:149:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
        activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
        activesupport (4.1.6) lib/active_support/callbacks.rb:86:in `call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:86:in `run_callbacks'
        actionpack (4.1.6) lib/abstract_controller/callbacks.rb:19:in `process_action'
        actionpack (4.1.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
        actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
        activesupport (4.1.6) lib/active_support/notifications.rb:159:in `block in instrument'
        activesupport (4.1.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
        activesupport (4.1.6) lib/active_support/notifications.rb:159:in `instrument'
        actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
        actionpack (4.1.6) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
        activerecord (4.1.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
        actionpack (4.1.6) lib/abstract_controller/base.rb:136:in `process'
        actionview (4.1.6) lib/action_view/rendering.rb:30:in `process'
        actionpack (4.1.6) lib/action_controller/metal.rb:196:in `dispatch'
        actionpack (4.1.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
        actionpack (4.1.6) lib/action_controller/metal.rb:232:in `block in action'
        actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `call'
        actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
        actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:50:in `call'
        actionpack (4.1.6) lib/action_dispatch/routing/mapper.rb:45:in `call'
        actionpack (4.1.6) lib/action_dispatch/journey/router.rb:73:in `block in call'
        actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `each'
        actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `call'
        actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:678:in `call'
        omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
        omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
        warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
        warden (1.2.3) lib/warden/manager.rb:34:in `catch'
        warden (1.2.3) lib/warden/manager.rb:34:in `call'
        rack (1.5.2) lib/rack/etag.rb:23:in `call'
        rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
        rack (1.5.2) lib/rack/head.rb:11:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/flash.rb:254:in `call'
        rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
        rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/cookies.rb:560:in `call'
        activerecord (4.1.6) lib/active_record/query_cache.rb:36:in `call'
        activerecord (4.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
        activerecord (4.1.6) lib/active_record/migration.rb:380:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
        activesupport (4.1.6) lib/active_support/callbacks.rb:82:in `run_callbacks'
        actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/reloader.rb:73:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
        railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app'
        railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call'
        activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
        activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
        activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged'
        railties (4.1.6) lib/rails/rack/logger.rb:20:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
        rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
        rack (1.5.2) lib/rack/runtime.rb:17:in `call'
        activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
        rack (1.5.2) lib/rack/lock.rb:17:in `call'
        actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call'
        rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
        railties (4.1.6) lib/rails/engine.rb:514:in `call'
        railties (4.1.6) lib/rails/application.rb:144:in `call'
        rack (1.5.2) lib/rack/lock.rb:17:in `call'
        rack (1.5.2) lib/rack/content_length.rb:14:in `call'
        rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
        /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
    

    配置/环境/ development.rb:

    # Show full error reports and disable caching.
    config.consider_all_requests_local       = true
    config.action_controller.perform_caching = false
    
    # Don't care if the mailer can't send.
    config.action_mailer.raise_delivery_errors = true
    
    config.action_mailer.perform_deliveries = true
    
    config.action_mailer.default_url_options = { :host => 'localhost:3000' }
    
    config.action_mailer.delivery_method = :smtp
    
    
    config.action_mailer.smtp_settings = {
       address: "smtp.gmail.com",
       port: 587,
       domain: ENV["gmail.com"],
       authentication: "plain",
       enable_starttls_auto: true,
       user_name: ENV["coolEmail@gmail.com"],
       password: ENV["coolPassword"],
       openssl_verify_mode: 'none',
    }
    

0 个答案:

没有答案