【发布时间】:2012-08-13 09:28:07
【问题描述】:
我需要使用邮件程序向用户发送电子邮件,以将他们的密码设置为设计和活动管理员的“可恢复”功能。在开发环境中,我通过将以下内容添加到这些文件中来做到这一点:
配置/环境/开发
#Added per active admin install instructions
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
#These settings are for the sending out email for active admin and consequently the devise mailer
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings =
{
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com', #you can also use google.com
:authentication => :plain,
:user_name => 'XXXXX@gmail.com',
:password => 'XXXXXXX'
}
如何在生产环境中获得相同的功能?我想将我的应用程序部署到 Heroku。我需要添加哪些文件和代码?
【问题讨论】:
-
您需要在 config/environments/production.rb 中使用相同的代码
-
如果所有环境都相同,则将其放在 config/application.rb 中
-
是的,但是我应该在生产中为此添加什么:config.action_mailer.default_url_options = { :host => '????' }
-
你的应用程序的 URL
config.action_mailer.default_url_options = { :host => 'YOURAPPNAME.herokuapp.com' }或 'yourcustomdomain.com' 如果使用一个
标签: ruby-on-rails heroku devise actionmailer production