我有 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
最佳答案
在 config/environments 中转到 production.rb,放在底部
config.action_mailer.default_url_options = { :host => 'http://nameofyourherokuapp.herokuapp.com' }
确保你的 smtp 设置也像在你的开发环境中一样
关于ruby-on-rails - 如何将设计中的邮件链接从本地主机更改为 herokuapp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13644461/