设置设备和Heroku 上的 Sendgrid

发布于 2024-11-07 09:04:08 字数 226 浏览 3 评论 0 原文

我的网站托管在 Heroku 上,我安装了 Sendgrid 附加组件,因为它看起来好得令人难以置信 - 但到目前为止,所有电子邮件功能都不起作用。我已阅读文档,它清楚地表明只需添加 - 附加 - 是否需要更多配置才能使 Devise 工作?

当我选择“向我发送新密码”时,我收到一个 404 页面,这让我觉得还有更多内容。比如 Sendgrid 如何知道/在哪里使用预安装的 Devise 模板?

谢谢。

My site is hosted on Heroku and I installed the Sendgrid Add-On as it looked almost too good to be true - but so far none of the email functionality is working. I have read the documentation and it clearly says just add-the add on - is more configuration required to get Devise working?

When I select 'send me new password' I get a 404 page which makes me think there is more to this. Like how does Sendgrid know/where to use the pre-installed Devise templates?

Thx.

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

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

发布评论

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

评论(2

逆光下的微笑 2024-11-14 09:04:08

我今天早上刚刚设置了 Devise 和 SendGrid,没有任何问题。我将继续我所采取的步骤。

首先,安装 Devise 和 SendGrid。恭喜,您已经完成了该操作;)

然后,为了进行生产,请将以下内容添加到您的文件中:

config/initializers/devise.rb

config.mailer_sender = "[email protected]"

设置 Rails ActionMailer 使用 SendGrid

config/environments/production.rb

config.action_mailer.default_url_options = { :host => 'your.websitedomain.com' }
ActionMailer::Base.smtp_settings = {
  :user_name            => ENV['SENDGRID_USERNAME'],
  :password             => ENV['SENDGRID_PASSWORD'],
  :address              => "smtp.sendgrid.net",
  :port                 => 587,
  :enable_starttls_auto => true,
  :authentication       => :plain,
  :domain               => "yourdomain.com"
}

并且一切都很好。注册确认、密码恢复...

此外,您应该使用 Logging Expanded(免费!)并检查使用 heroku logs --tail 记录您的日志(实时)。
如果仍然出现错误,请发布您的日志。

祝你有美好的一天 !

I just set up Devise and SendGrid this morning and have no problems. I'm going to resume the steps I took.

First, install Devise and SendGrid. Congratulations, you've already done that ;)

Then, for production, add this to your files:

config/initializers/devise.rb :

config.mailer_sender = "[email protected]"

Set up Rails ActionMailer to use SendGrid

config/environments/production.rb

config.action_mailer.default_url_options = { :host => 'your.websitedomain.com' }
ActionMailer::Base.smtp_settings = {
  :user_name            => ENV['SENDGRID_USERNAME'],
  :password             => ENV['SENDGRID_PASSWORD'],
  :address              => "smtp.sendgrid.net",
  :port                 => 587,
  :enable_starttls_auto => true,
  :authentication       => :plain,
  :domain               => "yourdomain.com"
}

And everything's working great with that. Sign up confirmations, password recovery...

Also, you should use Logging Expanded (it's Free!) and check your logs with heroku logs --tail (for real time).
If you still get errors, post your logs.

Have a good day !

忆伤 2024-11-14 09:04:08

我已经使用了 sendgrid 附加组件,它确实应该可以正常工作。就像你说的,即使文档也这么说:

使用 ActionMailer 的 Rails 应用程序即可正常工作,安装插件后无需任何设置。

所以,这让我觉得发生了其他事情。您是否尝试过使用 heroku logs 命令来查看您的应用程序正在记录任何错误吗?

I've used the sendgrid Add-On and it really should just work. Like you said, even the docs say so:

Rails apps using ActionMailer will just work, no setup is needed after the add-on is installed.

So, this makes me think something else is going on. Have you tried using the heroku logs command to see if your application is logging any errors?

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