2011-08-12 127 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