Ruby on rails 重新发送确认邮件错误网络::SMTPAuthenticationError in designe::confirmationController#create Net::SMTPauthenticationDesive::ConfirmationController#create中出现错误 530-5.5.1需要认证。了解更多信息,请访问
我正在使用宝石“设计” 使用gmail帐户发送确认电子邮件 但是,标题中出现了错误 我搜索了许多与我的案例类似的案例,并在那里尝试了解决方案,但那些完全不起作用,所以我认为我的错误有一些不同的根源 (我尝试的是:1.减少对myaccount.google.com/u/1/security的保护2。) development.rbRuby on rails 重新发送确认邮件错误网络::SMTPAuthenticationError in designe::confirmationController#create Net::SMTPauthenticationDesive::ConfirmationController#create中出现错误 530-5.5.1需要认证。了解更多信息,请访问,ruby-on-rails,email,authentication,send,Ruby On Rails,Email,Authentication,Send,我正在使用宝石“设计” 使用gmail帐户发送确认电子邮件 但是,标题中出现了错误 我搜索了许多与我的案例类似的案例,并在那里尝试了解决方案,但那些完全不起作用,所以我认为我的错误有一些不同的根源 (我尝试的是:1.减少对myaccount.google.com/u/1/security的保护2。) development.rb config.action_mailer.delivery_method = :smtp config.action_mailer.perform_delive
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:authentication => :plain,
:address => "smtp.gmail.com",
:port => 587,
:domain => "mail.google.com",
:user_name => ENV["******@gmail.com"],
:password => ENV["******"],
:enable_starttls_auto => true
}
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
错误页中最上面的错误行
def check_response(res)
unless res.success?
raise res.exception_class, res.message
end
end
请帮帮我。。。TT对于gmail设置的问题,您应该在直接向其添加字符串时删除ENV(据我所知,这是您的本地开发,这将产生错误,因为您还将config.action\u mailer.raise\u delivery\u errors=true
config.action_mailer.smtp_settings = {
:authentication => :plain,
:address => "smtp.gmail.com",
:port => 587,
:domain => "mail.google.com",
:user_name => "******@gmail.com",
:password => "******",
:enable_starttls_auto => true
}
谢谢。这很有效!!!你能解释一下本地开发的含义吗?以及与ENV的关系…ENV通常在生产中使用,在生产中,我们不会将密码直接放入此文件中,我们将密码放入OS system variabel以使其保存,以及rails access OS system variabel是如何使用ENV的,这可能会帮助您更好地了解和