更改 gmail 密码后,当用户尝试发送邮件时,heroku 会记录错误
After I changed gmail password, heroku logs error when user tries to send message
最近更改密码后,我的应用程序不允许用户发送定向到我的 gmail 的邮件。或者,我的 gmail 可能不接受来自我的应用程序的消息?我的 heroku 日志报告以下错误:
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.)
我试过:
• 更新我使用 Figaro 生成的 application.yml
文件中的密码。
• heroku restart
.
• 确保 Allow less secure apps:
在 gmail 中设置为 ON
。
• enabling/disabling enable_starttls_auto: true
.
我可以通过 heroku 控制台看到消息正在生产中保存 table。同样,问题是邮件从未在 gmail 中收到。此问题仅在生产中而不在开发中。
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
module ChrisPelnarDotCom
class Application < Rails::Application
config.active_record.raise_in_transactional_callbacks = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: ENV["gmail_username"],
password: ENV["gmail_password"],
authentication: 'plain',
enable_starttls_auto: true }
end
end
setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'www.yourdomain.com',
:user_name => ENV["gmail_username"],
:password => ENV["gmail_password"],
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = ENV["gmail_username"]
config/application.yml
gmail_username: "my_email@gmail.com"
gmail_password: "my_password"
您还需要在生产中使用 heroku config:set gmail_password=YOURNEWPASSWORD --app YOURAPPNAME
更新 gmail_password
环境变量中的密码。 application.yml
只应在开发中使用。
最近更改密码后,我的应用程序不允许用户发送定向到我的 gmail 的邮件。或者,我的 gmail 可能不接受来自我的应用程序的消息?我的 heroku 日志报告以下错误:
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.)
我试过:
• 更新我使用 Figaro 生成的 application.yml
文件中的密码。
• heroku restart
.
• 确保 Allow less secure apps:
在 gmail 中设置为 ON
。
• enabling/disabling enable_starttls_auto: true
.
我可以通过 heroku 控制台看到消息正在生产中保存 table。同样,问题是邮件从未在 gmail 中收到。此问题仅在生产中而不在开发中。
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
module ChrisPelnarDotCom
class Application < Rails::Application
config.active_record.raise_in_transactional_callbacks = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: ENV["gmail_username"],
password: ENV["gmail_password"],
authentication: 'plain',
enable_starttls_auto: true }
end
end
setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'www.yourdomain.com',
:user_name => ENV["gmail_username"],
:password => ENV["gmail_password"],
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = ENV["gmail_username"]
config/application.yml
gmail_username: "my_email@gmail.com"
gmail_password: "my_password"
您还需要在生产中使用 heroku config:set gmail_password=YOURNEWPASSWORD --app YOURAPPNAME
更新 gmail_password
环境变量中的密码。 application.yml
只应在开发中使用。