Michael
Michael

Reputation: 644

Sending an email in Rails

I'm trying to send an email using Ruby on Rails but I get the error:

Net::SMTPAuthenticationError in UsersController#create

535-5.7.1 Username and Password not accepted.


But the username and password combination is correct. I've gone through it multiple 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
}

Upvotes: 4

Views: 1955

Answers (2)

eugen
eugen

Reputation: 9226

Your username has to be

:user_name => "[email protected]"

For gmail the domain is required.

Upvotes: 2

Related Questions