有人在 EngineYard 上成功设置了电子邮件设置吗?

发布于 2024-09-04 04:07:26 字数 330 浏览 5 评论 0原文

我正在尝试向我的应用程序添加电子邮件功能(忘记密码、通知等),并且我正在使用 EngineYard 进行托管。我已在测试环境中成功配置了电子邮件,但在上传到 EY 后,它似乎在生产中出错。我不支付他们的支持费用,并且唯一的资源有点模糊(或者超越我)。

我很想知道在 EY 上使用电子邮件时是否需要添加任何特定文件、设置服务器等。我正在使用 Google 应用程序,所以我认为这就像在生产中添加相同的代码块进行测试一样简单,但情况似乎并非如此。

I am attempting to add email capabilities to my app (forgotten password, notifications, etc.) and I am using EngineYard for hosting. I have successfully configured email in my test environment but upon uploading to EY it seems to error out in Production. I don't pay for their support and the only resource is a bit vague (or beyond me).

I am curious to know if there is any specific file additions, server set up etc. that is needed when using email on EY. I am using Google apps so I thought it would be as easy as adding the same code block for test in production but doesn't seem to be the case.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

血之狂魔 2024-09-11 04:07:26

这是我的 Google 应用程序配置,位于 .../config/environments/production.rb:

require 'tlsmail' 
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {
  :address => 'smtp.gmail.com',
  :port => 587,
  :tls => true,
  :domain => 'example.com',
  :authentication => :plain,
  :user_name => "[email protected]",
  :password => 'tr1ckypwd!'
}

注意,出于安全考虑,我实际上将密码保存在一个单独的文件中,并有代码将其修补到启动时的设置中,但我认为这会分散人们对回应实质内容的注意力。

希望有帮助。

Here's my config for Google apps, in .../config/environments/production.rb:

require 'tlsmail' 
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {
  :address => 'smtp.gmail.com',
  :port => 587,
  :tls => true,
  :domain => 'example.com',
  :authentication => :plain,
  :user_name => "[email protected]",
  :password => 'tr1ckypwd!'
}

Note, for the security minded out there, I actually keep the password in a separate file and have code to patch it into the settings on launch, but I figured that would distract from the meat of the response.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文