使用 Rails 3 在 Heroku 上运行 Gmail
我正在尝试从 Heroku 发送电子邮件并运行。目前,我可以通过 http:// 上的“教程”从 Heroku 发送电子邮件/blog.heroku.com/archives/2009/11/9/tech_sending_email_with_gmail/,这样就可以了。
我当前的问题是,当我让它在 Heroku 上工作时,我无法让它在开发中工作。我已经使用environment.rb或development.rb中的设置启动并运行了它,但是在教程中的内容启动并且我删除了env/dev.rb中的设置之后,它不起作用。
在浏览器中我收到错误消息: 530-5.5.1 需要身份验证。了解更多信息
(它在了解更多信息之后剪切)
在服务器控制台中,我收到错误消息: Net::SMTPAuthenticationError(530-5.5.1 需要身份验证。了解更多信息
):
我已经设置了 heroku config:add [email protected]
和 heroku config:add GMAIL_SMTP_PASSWORD=yourpassword
(带有我的信息;)),但它没有帮助。
有什么想法我做错了吗?
我可以在开发中采用旧的方式来完成并以某种方式跳过heroku脚本吗?
干杯卡尔
I am trying to send emails from Heroku up and running. At the moment I can send emails from Heroku via the "tutorial" at http://blog.heroku.com/archives/2009/11/9/tech_sending_email_with_gmail/, so that is fine.
My current problem is that when I got it to work at Heroku, I can't get it to work in development. I had that up and running with settings in either environment.rb or development.rb, but after the stuff in the tutorial kicked in and I removed the settings in env/dev.rb it doesn't work.
In the browser I get the error msg:530-5.5.1 Authentication Required. Learn more at
(it cuts after Learn more at)
In the server console I get the error msg:Net::SMTPAuthenticationError (530-5.5.1 Authentication Required. Learn more at
):
I have set heroku config:add [email protected]
and heroku config:add GMAIL_SMTP_PASSWORD=yourpassword
(with my info ;)), but it doesn't help.
Any ideas what I am doing wrong?
Can I do it the old way in development and skip the heroku script in some way?
Cheers Carl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
按照上述用户所说的 SMTP 设置即可。
除此之外,Gmail 还会阻止未经您验证的应用程序对您的帐户进行未经身份验证的登录。
因此,请转到您的 Gmail 客户端并登录。
如果不起作用,请转至解锁验证码
Just do as the above user has said about the SMTP settings.
In addition to that, Gmail blocks unidentified logins from a application to your account without you verifying it.
So go to your Gmail client and log in there.
If that doesn't work go to unlock captcha
我个人曾遇到过使用 Gmail 发送邮件时出现的错误,需要解决解锁验证码才能允许发送。 Gmail 有时对安全性很挑剔,而且文档也不是很明显。
完整消息应为:
请查看该链接 并按照那里的说明进行操作。
您可能需要登录 Gmail 网络应用,或者(我必须这样做)解决解锁验证码问题。或者可能是您的应用程序或环境中的某些内容,但遵循 Google 指示值得一试。
I have personally encountered that error sending with Gmail and needed to solve an unlock CAPTCHA to allow the sending. Gmail can be picky with security sometimes, and the documentation is not very apparent.
The full message should read:
so check out that link and follow the directions there.
You might need to sign into the Gmail webapp or (what I had to do), solve the unlock CAPTCHA. Or perhaps it is something in your app or environment, but following the Google directions is worth a shot.
请在 config/environments/development.rb 中添加以下代码
,并确保已在 config/initializers/smtp_gmail.rb 中添加以下代码
Please add the following code in config/environments/development.rb
and also make sure you have added the following in config/initializers/smtp_gmail.rb
您是否在本地计算机上导出了这些环境变量?您说您要将 GMAIL_SMTP... 添加到 Heroko 配置中,但是您是:
$ export [电子邮件受保护]
$ export GMAIL_SMTP_PASSWORD=yourpassword
我遇到了你的问题,因为我也有电子邮件在开发中工作,并且想知道 2009 年关于如何获取 smtp & 的帖子是否有效。 gmail 在 Heroku 上工作仍然是必要的。显然是这样。
Did you export those environment variables on your local machine? You say you're adding the GMAIL_SMTP... to heroko config, but are you:
$ export [email protected]
$ export GMAIL_SMTP_PASSWORD=yourpassword
I ran into your question because I also have email working in dev, and wondered if the 2009 post about how to get smtp & gmail to work on heroku is still necessary. Apparently so.
我在 heroku 应用程序上通过 Gmail 发送邮件。这是我的配置,如果有帮助的话。我没有使用任何第三方插件,只是使用 Rails 3。
在
config/initializers/setup_mail.rb
中 在
config/environments/Production.rb
中
end<对于
config
块的 /code> 语句,我添加了ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false
I have mail being sent via Gmail on a heroku app. Here is my config if it helps. I am not using any third party plugins, just Rails 3.
In
config/initializers/setup_mail.rb
In
config/environments/production.rb
After the
end
statement for theconfig
block, I have addedActionMailer::Base.smtp_settings[:enable_starttls_auto] = false