I am trying to set up the "forgot password" function that comes with devise. I am using rails 5. It always gives me the error: "535-5.7.8 Username and Password not accepted"(Net::SMTPAuthenticationError in Users::PasswordsController#create though.
My code looks like this:
In development.rb I added:
config.action_mailer.default_url_options = { host: 'localhost', port:3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default :charset => "utf-8"
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:domain => 'gmail.com',
:user_name => '[email protected]',
:password => 'abcde',
}
Under config > initialisers > devise.rb I added:
config.mailer_sender = "[email protected]"
and under config > environment.rb:
ActionMailer::Base.delivery_method = :smtp
Am I missing anything or did I do something wrong?
Also another question: I need to link it to my personal account (i.e. replace the user_name and password with the details of a real email account), there is no default devise account the emails get sent from, right? I'm just wondering because like this everyone in my team would be able to see the password of the mail account we're using, right?
Any advice would be highly appreciated! Thanks in advance.