2011-08-12 62 views
4

我试图发送使用Ruby on Rails的电子邮件,但我得到的错误:发送电子邮件Rails中

Net::SMTPAuthenticationError in UsersController#create

535-5.7.1 Username and Password not accepted.


但用户名和密码组合是正确的。我经历过多次。

这是我的setup_mail.rb:
我出于隐私原因更改了用户名,密码和域名。

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

回答

2

您的用户名必须是

:user_name => "[email protected]" 

对于Gmail需要的域。

+0

我想你也必须使用TLS进行验证。 – JonLim