gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 22:49:50 26 4
gpt4 key购买 nike

每当我尝试在我的 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
}

关于ruby-on-rails - 连接到 gmail 时 Rails 3.1.0.rc5 中的 Net::SMTPAuthenticationError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6956018/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com