问题 带有Rails 3的heroku上的Gmail


我正在尝试从Heroku发送和运行电子邮件。目前我可以通过“教程”发送来自Heroku的电子邮件 http://blog.heroku.com/archives/2009/11/9/tech_sending_email_with_gmail/,这很好。

我目前的问题是,当我在Heroku工作时,我无法让它在开发中工作。我已经启动并运行了environment.rb或development.rb中的设置,但是在教程中的内容启动后我删除了env / dev.rb中的设置它不起作用。

在浏览器中我收到错误消息: 530-5.5.1 Authentication Required. Learn more at (在了解更多信息后减少)

在服务器控制台中,我收到错误消息: Net::SMTPAuthenticationError (530-5.5.1 Authentication Required. Learn more at
):

我已经设定 heroku config:add GMAIL_SMTP_USER=username@gmail.com 和 heroku config:add GMAIL_SMTP_PASSWORD=yourpassword (用我的信息;)),但它没有帮助。

我有什么想法我做错了吗?

我可以在开发中使用旧方法并以某种方式跳过heroku脚本吗?

干杯卡尔


7553
2017-10-21 22:13


起源

我在Linode实例中使用Gmail的Rails动作邮件也遇到了同样的问题。它工作正常前2天,但今天突然显示出错误。 - Autodidact
你有没有找到解决这个问题的方法?我有同样的问题... - oFca


答案:


就像上面的用户说的SMTP设置一样。
除此之外,Gmail会阻止从应用程序到您帐户的未识别登录,而无需您进行验证。
请转到您的Gmail客户端并登录。

如果这不起作用去 解锁验证码


6
2017-08-24 09:06



我收到此错误:Net :: SMTPAuthenticationError(534-5.7.14 <accounts.google.com/ContinueSignIn?plt = ...)。访问您的链接修复它。谢谢! - Rich Aston


我个人遇到了使用Gmail发送错误并需要解锁解锁CAPTCHA以允许发送。 Gmail有时会带有安全性,而且文档不是很明显。

完整的信息应为:

530-5.5.1 Authentication Required. Learn more at https://support.google.com/mail/bin/answer.py?hl=en&answer=14257

所以退房 那个链接 并按照那里的指示。

您可能需要登录Gmail网络应用或(我必须做的), 解决解锁CAPTCHA。或者它可能是您的应用或环境中的某些内容,但遵循Google的指示值得一试。


5
2017-07-29 22:05





请在下面添加以下代码 配置/环境/ development.rb 

config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true

并确保您已添加以下内容 配置/初始化/ smtp_gmail.rb

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => "abc@xyz.com",
  :password             => "password",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

2
2017-07-27 13:21





您是否在本地计算机上导出了这些环境变量?你说你要将gMAIL_SMTP ...添加到heroko配置中,但是你是:

$ export GMAIL_SMTP_USER=username@gmail.com $ export GMAIL_SMTP_PASSWORD =你的密码

我遇到了你的问题,因为我也有开发电子邮件工作,并想知道2009年关于如何让smtp和gmail在heroku上工作的帖子仍然是必要的。显然是这样。


1
2017-11-02 19:19





我在heroku应用程序上通过Gmail发送邮件。这是我的配置,如果它有帮助。我没有使用任何第三方插件,只有Rails 3。

config/initializers/setup_mail.rb

ActionMailer::Base.smtp_settings = {
  :address  => "smtp.gmail.com",
  :port  => 587,
  :user_name  => "foo@bar.com",
  :password  => "foobar",
  :authentication  => :plain,
  :enable_starttls_auto => true
}

config/environments/production.rb

之后 end 声明 config 块,我补充说

ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false


1
2017-07-19 19:42