带有Rails 3的heroku上的Gmail

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

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

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

在服务器控制台中,我收到错误消息: Net::SMTPAuthenticationError (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.comheroku config:add GMAIL_SMTP_PASSWORD=yourpassword (带我的信息;)),但它没有帮助。

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

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

干杯卡尔

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

如果这不起作用去解锁validation码

我个人遇到了使用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的指示值得一试。

请在config / environments / development.rb中添加以下代码

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

并确保在config / initializers / 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 } 

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

$ export GMAIL_SMTP_USER=username@gmail.com $ export GMAIL_SMTP_PASSWORD = yourpassword

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

我在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

config块的end语句之后,我添加了

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