连接到 gmail 时 Rails 3.1.0.rc5 中的 Net::SMTPAuthenticationError [英] Net::SMTPAuthenticationError in rails 3.1.0.rc5 when connecting to gmail

查看:62
本文介绍了连接到 gmail 时 Rails 3.1.0.rc5 中的 Net::SMTPAuthenticationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在我的 rails 应用程序中发送通知时,我都会收到以下错误

When ever time i try sending notifications in my rails app i get the following error

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 邮件配置设置是

my development.rb mail config settings is

  # 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'
  }

推荐答案

我有这个,它对我有用:

I have this and it works for me:

  ActionMailer::Base.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :user_name            => "name@example.com",
    :password             => 'password',
    :authentication       => "plain",
    :enable_starttls_auto => true
  }

这篇关于连接到 gmail 时 Rails 3.1.0.rc5 中的 Net::SMTPAuthenticationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆