我需要使用一个邮件组件来向用户发送设置密码的电子邮件,以便在 Devise 和 active admin 的“可恢复”功能中使用。在开发环境中,我通过在这些文件中添加以下内容来实现此目的:
config/environments/development
#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.action_mailer.default_url_options = { :host => 'YOURAPPNAME.herokuapp.com' }
,如果使用自定义域名则为yourcustomdomain.com
。 - house9