我正在尝试使用
Ruby on 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
}
最佳答案 您的用户名必须是
:user_name => "myname@mydomain.com"
对于gmail,域名是必需的.