Missing host to link to! Please provide :host parameter

If you’ve followed my version of the authlogic account activation tutorial or the original version by Matt Hooks you might have run into this error:

Missing host to link to! Please provide :host parameter or set default_url_options[:host] when sending emails

When authlogic sends e-mails with the account activation link, it uses a url_for helper to build that link. Because the “Notifier” mailer is an instance of ActionMailer::Base and not ActionController::Base it doesn’t know what the host parameter of the URL should be, so you have to tell it explicitly.

Put the following into your environments/development.rb and environments/test.rb:

1
2
# This assumes you're running your local development server on port 3000 via script/server
config.action_mailer.default_url_options = { :host => "127.0.0.1:3000" }

Put this into your environments/production.rb:

1
2
# Replace example.org with your actual domain name
config.action_mailer.default_url_options = { :host => "example.org" }

Comments

  1. Thanks for the clarification!

  2. Thanks for your help!!
    My problem got solved :–)

Trackbacks

  1. [...] the “Missing host to link to! Please provide :host parameter ” error see this post Missing host to link to! Please provide :host parameter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [...]

Speak Your Mind

*