I am getting error when I try to send an e-mail. I am trying to send email from localhost.. the actionmailer setting are
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.com",
:authentication => :plain,
:user_name => "[email protected]",
:password => "mypassword"
}
When I configured it first time the email was working fine. but after sending 4 or 5 email the functionality stopped working and shows me this error
Net::SMTPAuthenticationError ............
535-5.7.1 Username and Password not accepted.
Where could be a problem?
Thanks..
If getting "Username and Password not accepted" 535 5.7. 8 error, but user name and password work logging onto email via web (with 2-factor authentication), you may need to enable "Access for less secure apps" (allow exceptions to 2-factor authentication) in your email settings.
smtp error Error: Invalid login: 535-5.7. 8 Username and Password not accepted. It typically indicates that you did not enable Less Secure Apps on the inbox side of your email address.
I was trying to send using smtp from a ruby application on my hosted webserver, and was getting denied, something Gmail does a security precaution.
The solution was first to login to gmail in my own browser on my laptop, as usual. There was an alert at the top saying gmail had detected suspicious activity. "Was it you?" I clicked through a few steps saying it was me and was brought to a screen that said:
Next step
Sign in using the application you want to authorize access to your account within the next ten minutes. Google will remember the application after it signs in, and will allow it to access your account in the future as long as it uses the correct password.
I then ssh'd into my server, and from the command line did:
lynx http://mail.google.com/mail/?ui=html
I then logged into gmail using lynx, and the problem was solved.
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