Rails 3 - sendgrid 设置以支持设备

发布于 2024-09-30 17:26:03 字数 696 浏览 1 评论 0原文

我正在尝试使用 Devise 在我的 Rails 3 应用程序上运行 sendgrid,以便 devise 可以发送注册电子邮件等。

我添加了以下内容,config/setup_mail.rb:

ActionMailer::Base.smtp_settings = {
  :address => "smtp.sendgrid.net",
  :port => '25',
  :domain => "XXXXXXXXX.com",
  :authentication => :plain,
  :user_name => "[email protected]",
  :password => "XXXXXXXXXX"
}

这对于 Rails + Devise 发送来说还不够吗注册电子邮件?或者我需要其他东西或某种宝石吗?

日志显示正在生成的电子邮件,但我在日志中没有看到任何有关邮件发送成功或出错的信息。我的 sendgrid 帐户仍然显示已发送 0/200 封电子邮件。

Rails 中是否有更好的方法来查看尝试发送电子邮件时发生的情况?

谢谢

I'm trying to get sendgrid running on my Rails 3 App with Devise, so devise can send out registration emails etc..

I added the following, config/setup_mail.rb:

ActionMailer::Base.smtp_settings = {
  :address => "smtp.sendgrid.net",
  :port => '25',
  :domain => "XXXXXXXXX.com",
  :authentication => :plain,
  :user_name => "[email protected]",
  :password => "XXXXXXXXXX"
}

Shouldn't that be enough for Rails + Devise to send out registration emails? Or do I need something else or a gem of some kind?

The logs show the email being generated but I don't see anything in the log about MAIL being sent successfully or erroring. And my sendgrid account still says 0/200 emails sent.

Is there a better way in Rails to see what's going on when it trys to send the email?

Thanks

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

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

发布评论

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

评论(2

隔岸观火 2024-10-07 17:26:03

您可以删除已有的设置。

heroku addons:create sendgrid:free

这是使用 heroku 配置电子邮件所需的唯一代码片段。

确保你有你的主机链接设置,我认为你做了,因为它会导致它崩溃,但如果你没有:

config.action_mailer.default_url_options = { :host => 'myapp.heroku.com' }

实际上最后一个留置权在rails3上是不同的,所以要小心:)

“config”行需要是添加到您的“生产.rb”文件中。

You can erase the setup that you have.

heroku addons:create sendgrid:free

That is the only pieces of code you need to get email configured with heroku.

Make sure you have your host link setup which I think you did because it will cause it to crash but if you haven't:

config.action_mailer.default_url_options = { :host => 'myapp.heroku.com' }

Actually this last lien is different on rails3 so watch out for that :)

The "config" line needs to be added to your "production.rb" file.

○闲身 2024-10-07 17:26:03

我自己也在寻找同样的答案。在 intializers/devise.rb 中,我读到:

  # Configure the class responsible to send e-mails.
  # config.mailer = "Devise::Mailer"

我想知道是否必须告诉 Devise 使用 Actionmailer。

I'm searching for the same answer myself. In intializers/devise.rb I read:

  # Configure the class responsible to send e-mails.
  # config.mailer = "Devise::Mailer"

I wonder if Devise has to be told to use Actionmailer.

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