Sending Email in Rails

I am trying to send an email using Ruby on Rails, but I am getting an error:

Net :: SMTPAuthenticationError in UsersController # create

535-5.7.1 Username and password are not accepted.


But the combination of username and password is correct. I have experienced this several times.

This is my setup_mail.rb:
I changed the username, password and domain for privacy reasons.

ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "mydomain.com", :authentication => "plain", :user_name => "myname", :password => "mypw", :enable_starttls_auto => true } 
+4
source share
2 answers

Your username must be

 :user_name => " myname@mydomain.com " 

Gmail requires a domain.

+2
source

All Articles