ActionMailer and url_for in helper methods

Use the :host option to make it build the whole URL, like this:

url_for( {:host =>‘’, :controller => ‘page’, :id => 1 } )

Unfortunately, my email is using helper methods that are also used
throughout the application, so I don't want to hardcode or pass around a
host variable everywhere (because there are a lot of URLs being
generated). I thought the ActionMailer::Base.default_url_options[:host]
would help but it doesn't seem to work inside the scope of helper

Ryan Waldron wrote:

Perhaps this would be of use:

You may also need to pass ‘:only_path => false’, since this was at one point a requirement with link_to:

This is also fun: