Question

Im having 2 different languages in my rails app and would like to be able to set the domain name set in the right language. For example if a user registers from app.FR I want in below example the extension .FR used instead of .COM is there a way to do that?

  config.action_mailer.asset_host = "http://app.com"
  config.action_mailer.default_url_options = {:host => 'app.com'}
Was it helpful?

Solution

It seems that the solution is setting a before filter in your ApplicationController and make a function like:

  def set_mailer_host
    ActionMailer::Base.default_url_options[:host] = request.host_with_port
  end

Remember when sending mail from rails console this will not work since rails console will not pass true ActionController.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top