如何让Devise在Heroku上发送确认电子邮件?

时间:2022-07-08 22:55:40

I am on heroku so am not clear where and how to set it up so that devise can send out emails.

我在heroku上所以不清楚在哪里以及如何设置它以便设计可以发送电子邮件。

I actually have two directions to go:

我实际上还有两个方向:

  1. I am using sendgrid, so am wondering how it works with that.

    我正在使用sendgrid,所以我想知道它是如何工作的。

  2. For my hand-rolled mailers, I use PostageApp, which I'd prefer because it allows me to see what's going on with my email. The way I use PostageApp is my Mailers are a class of PostageApp's mailer.

    对于我的手动邮寄,我使用PostageApp,我更喜欢它,因为它可以让我看到我的电子邮件发生了什么。我使用PostageApp的方式是我的Mailers是一类PostageApp的邮件程序。

Thanks.

2 个解决方案

#1


6  

In Rails 3 I used the following settings in config/environments/production.rb

在Rails 3中,我在config / environments / production.rb中使用了以下设置

# Disable delivery errors, bad email addresses will be ignored
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => '##YOUR_PROJECTNAME##.heroku.com' }
ActionMailer::Base.smtp_settings = {
  :address    => "smtp.sendgrid.net",
  :port       => 25,
  :user_name  => ENV['SENDGRID_USERNAME'],
  :password   => ENV['SENDGRID_PASSWORD'],
  :domain     => ENV['SENDGRID_DOMAIN'],
  :authentication  => :plain
}

Note: you'll need to substitute in your project name - but all those ENV variables are populated for you automatically by heroku.

注意:您需要替换项​​目名称 - 但是所有这些ENV变量都由heroku自动填充。

#2


0  

I just wanted to let you guys know that with the help of one of our customers, we have been able to add integration instructions for Devise with Postage to our documentation. He has also told us that he is updating the code to work with the newer, modularized version of Devise, and he will give us the code as soon as it is ready.

我只是想让大家知道,在我们的一位客户的帮助下,我们已经能够将Devise with Postage的集成说明添加到我们的文档中。他还告诉我们他正在更新代码以使用更新的模块化Devise版本,并且他会在准备好后尽快给我们代码。

#1


6  

In Rails 3 I used the following settings in config/environments/production.rb

在Rails 3中,我在config / environments / production.rb中使用了以下设置

# Disable delivery errors, bad email addresses will be ignored
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => '##YOUR_PROJECTNAME##.heroku.com' }
ActionMailer::Base.smtp_settings = {
  :address    => "smtp.sendgrid.net",
  :port       => 25,
  :user_name  => ENV['SENDGRID_USERNAME'],
  :password   => ENV['SENDGRID_PASSWORD'],
  :domain     => ENV['SENDGRID_DOMAIN'],
  :authentication  => :plain
}

Note: you'll need to substitute in your project name - but all those ENV variables are populated for you automatically by heroku.

注意:您需要替换项​​目名称 - 但是所有这些ENV变量都由heroku自动填充。

#2


0  

I just wanted to let you guys know that with the help of one of our customers, we have been able to add integration instructions for Devise with Postage to our documentation. He has also told us that he is updating the code to work with the newer, modularized version of Devise, and he will give us the code as soon as it is ready.

我只是想让大家知道,在我们的一位客户的帮助下,我们已经能够将Devise with Postage的集成说明添加到我们的文档中。他还告诉我们他正在更新代码以使用更新的模块化Devise版本,并且他会在准备好后尽快给我们代码。