Sending an email in Rails
I'm trying to send an email using Ruby on Rails but I get the error:
Net::SMTPAuthent开发者_运维百科icationError 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
}
Your username has to be
:user_name => "myname@mydomain.com"
For gmail the domain is required.
Check if this link is helpful
https://github.com/diaspora/diaspora/issues/1539
http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/75/
Net::SMTPAuthenticationError in rails 3.1.0.rc5 when connecting to gmail
thanks
sameera
精彩评论