I'm pretty sure I have everythign configured right, but I keep getting 'Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at' error when trying to send mails through my rails app. Also, there is only a blank space after the 'at' in the error message so I don't even know where to look for more information. I am also 100% sure the password and email are correct.
in my config/development.rb (I also have this in application.rb)
config.action_mailer.delivery_method = :smtp
# SMTP settings for gmail
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:user_name => '[email protected]',
:password => 'password',
:authentication => 'plain',
:enable_starttls_auto => true
}
I have allowed less secure apps access on the actual gmail account.
Go to the config folder of your emails project and open environment. rb file and add the following line at the bottom of this file. It tells ActionMailer that you want to use the SMTP server. You can also set it to be :sendmail if you are using a Unix-based operating system such as Mac OS X or Linux.
1 Introduction. Action Mailer allows you to send emails from your application using a mailer model and views. So, in Rails, emails are used by creating mailers that inherit from ActionMailer::Base and live in app/mailers. Those mailers have associated views that appear alongside controller views in app/views.
Google blocks all suspicious login attempts. By using app password, I was able to solve the problem:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With