Ruby on rails Net::SMTPAuthenticationError[不接受用户名和密码]
当应用程序试图发送确认电子邮件时,我在生产中遇到了此错误。该应用程序正在使用spreeRuby on rails Net::SMTPAuthenticationError[不接受用户名和密码],ruby-on-rails,ruby,smtp,spree,Ruby On Rails,Ruby,Smtp,Spree,当应用程序试图发送确认电子邮件时,我在生产中遇到了此错误。该应用程序正在使用spree enter code herNet::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. Learn more at ): `app/controllers/spree/user_registration_controller_decorator.rb:5:in `create`' e 这里是
enter code herNet::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. Learn more at
):
`app/controllers/spree/user_registration_controller_decorator.rb:5:in `create`'
e
这里是production.rb中我的conf文件的一部分
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host:'mydomain.com' }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => 'myemailhere@gmail.com',
:password => 'passwordhere',
:authentication => :plain,
:enable_starttls_auto => true
我对我的电子邮件和通行证很有把握。我还更改了在的设置,并尝试在启用访问后发送电子邮件,但不知道我还能做什么。也许狂欢是有原因的。我对它真的不熟悉
使用以下设置:
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'smtp.gmail.com',
:user_name => "username@gmail.com",
:password => "yourpassword",
:authentication => :login,
:enable_starttls_auto => true
}
确保您可以访问在上打开的不太安全的应用
从以前用于访问google帐户的其他设备转到。
参考:
邮件发送现在应该可以了
Spree Commerce提示:使用具有以下设置的gem:
在production.rb中包含您的电子邮件和密码有点困难,特别是当您使用git这样的版本控制系统时。考虑使用宝石或类似的东西。