# Localized host in ActionMailer Views

**URL:** <https://www.ruby-forum.com/t/localized-host-in-actionmailer-views/184426>\
**Category:** Rails\
**Created:** [March 2, 2010, 1:31pm UTC](https://www.ruby-forum.com/t/localized-host-in-actionmailer-views/184426 "2010-03-02T13:31:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeonS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@LeonS](https://www.ruby-forum.com/u/LeonS)\
**Post date:** [March 2, 2010, 1:31pm UTC](https://www.ruby-forum.com/t/localized-host-in-actionmailer-views/184426/1 "2010-03-02T13:31:41Z")

</div>

Hi,

I’ve got some domains , lets say [example.com](http://example.com) and [example.de](http://example.de) and I want  
that the link in a ActionMailerView contains the correct localized  
host e.g. with \<%= @root\_url %\> .  
Currently the host is set in the environment.rb with  
“config.action\_mailer.default\_url\_options = { :host =\>  
“[example.com](http://example.com)” }”.  
How can I set the host dynamically and localized? I’m sending my mails  
though a Delayed Job.  
Thanks.

greetings  
LeonS

---

<div class="post-metadata">

**Author:** ![LeonS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@LeonS](https://www.ruby-forum.com/u/LeonS)\
**Post date:** [March 2, 2010, 2:07pm UTC](https://www.ruby-forum.com/t/localized-host-in-actionmailer-views/184426/2 "2010-03-02T14:07:24Z")

</div>

I think i need to determine the “request.host\_with\_port” in the  
controller and pass it as an argument to the notifier and to the  
delayed Job.  
Is there a better way to do that?
