title: How to change host for all links in mailers without modifying the views
body: <p>What I need to do is to include the current host name into all the links generated by mailers.</p>
  
  <p>The problems:</p>
  
  <ol>
  <li>Emails are generated in the background and of course do not have access to the current request.</li>
  <li>I want to avoid modifying any of the templates (updating the mailer class is ok, but not the templates). So that any routing helpers (including ones I do not control, such as devise) still works as expected.</li>
  </ol>
  
  <p>For example, user goes to the restore password on the <code>abc.example.com</code>. The email she receives receives should have the link to the <code>abc.example.com/whatever</code> and not the <code>example.com/whatever</code>.</p>
  
  <p>Similarly, if a user goes to the <code>other.example.com</code> and any email is sent to her while she's being using <code>other.example.com</code> should point to the same domain name.</p>
  
  <p>I'm pretty sure there should be a way to hook into <code>action_mailer</code> to achieve this. So what are those hooks?</p>
  
  <p>Thanks.</p>