微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 连接到gmail时,在rails 3.1.0.rc5中的Net :: SMTPAuthenticationError

什么时候我尝试发送通知在我的rails应用程序,我得到以下错误
Net::SMTPAuthenticationError (535-5.7.1 Username and Password not accepted. Learn more at                   
):
  app/models/friendship.rb:6:in `send_request'
  app/controllers/friends_controller.rb:21:in `make_friendship'

我的development.rb邮件配置设置是

# Don't care if the mailer can't send
  config.action_mailer.raise_delivery_errors = true

  config.action_mailer.delivery_method = :smtp
  # Gmail SMTP server setup
  config.action_mailer.smtp_settings = {
        :address => "smtp.gmail.com",:enable_starttls_auto => true,:port => 587,:domain => '@example.com',:authentication => :plain,:user_name => 'user@gmail.com',:password => 'secret'
  }

解决方法

我有这个,它适用于我:
ActionMailer::Base.smtp_settings = {
    :address              => "smtp.gmail.com",:port                 => 587,:user_name            => "name@example.com",:password             => 'password',:authentication       => "plain",:enable_starttls_auto => true
  }

原文地址:https://www.jb51.cc/ruby/272341.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐