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" } |