Pergunta

Im trying to send a forgot password email. However the following error occurs -

 Net::SMTPAuthenticationError in Devise::PasswordsController#create
 535-5.7.8 Username and Password not accepted. Learn more at

I manage to see the sent email within the logs file but not within my actual inbox. Any ideas on how to fix this error?

Heres my development.rb code -

config.action_mailer.raise_delivery_errors = true

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "gmail.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: "myemail@gmail.com",
  password: "mypassword"
}

Using: rails 4 and devise 3.2.3

Thanks

Foi útil?

Solução

This error usually occurs when the associated email address is setup for 2-factor authentication. If you want to test with the same gmail account then generate an Application specific password. See details here.

If you have a another gmail account which does not require 2-factor authentication then try that one instead in your code.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top