在 Rails 中发送电子邮件
我尝试使用 Ruby on Rails 发送电子邮件,但收到错误:
UsersController#create 中的 Net::SMTPAuthenticationError
535-5.7.1 用户名和密码不被接受。
但用户名和密码组合是正确的。我已经经历过很多次了。
这是我的 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
}
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
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的用户名必须是
对于 gmail,需要域。
Your username has to be
For gmail the domain is required.
检查此链接是否有帮助
https://github.com/diaspora/diaspora/issues/1539< /a>
http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/75/
Rails 中的 Net::SMTPAuthenticationError 3.1.0.rc5 连接 gmail 时
感谢
Sameera
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