
Struggling To Find Error While Working With SMTP Gmail
Get rid of SMTP Authentication Error in a few easy steps. Here’s a simple code that can help you reconfigure SMTP settings to remove the error.
Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at
from /home/botree/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/smtp.rb:981:in `check_auth_response'
Don’t search anymore. You just have to enable the following setting.

And here is SMTP setting I am using to send emails using Gmail for ready reference
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.smtp_settings = {
user_name: Rails.application.credentials.dig(:smtp, :user_name),
password: Rails.application.credentials.dig(:smtp, :password),
domain: 'gmail.com',
address: 'smtp.gmail.com',
port: '587',
authentication: :plain,
enable_starttls_auto: true
}
Read Also: How To Migrate Emails from G-suit Account
