如何将设备中的邮件链接从localhost更改为herokuapp?

时间:2012-11-30 11:33:19

标签: ruby-on-rails ruby-on-rails-3 heroku devise devise-confirmable

我有rails应用程序,我已经在heroku中托管了。当用户被创建时,设计会向邮件发送确认信息,点击链接将确认用户帐户。问题是邮件中的链接指向localhost而不是herokuapp.com,因此如何将链接从localhost更改为herokuapp.com。请帮帮我

邮件中的链接指向

http://localhost:3000/signup/confirmation?confirmation_token=sdgfshtdf364wygd

但我希望链接指向

http://example.herokuapp.com/signup/confirmation?confirmation_token=sdgfshtdf364wygd 

2 个答案:

答案 0 :(得分:6)

在config / environments中,转到production.rb,在底部put

 config.action_mailer.default_url_options = { :host => 'http://nameofyourherokuapp.herokuapp.com' }

确保您在其中具有smtp设置,就像在开发环境中一样

答案 1 :(得分:2)

application.rb 中设置

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

或者在环境目录环境中制作