This project is archived and is in readonly mode.

#148 ✓invalid
Nathan Wilmes

ActionMailer URL generation uses host/port from request

Reported by Nathan Wilmes | May 8th, 2008 @ 08:34 PM

ActionMailer relies on the UrlWriter module to generate all of the URLs needed for links. Because UrlWriter doesn't know anything about the current request, it becomes extremely hard to make the link aware of domain information (host/port/protocol). The Rails doc examples refer to using setting default_url_options in your mailer definitions, which means that they cannot be environment aware. Another solution I've seen used is to set domain-related model variables to be used by the mailer templates.

The following patch is a (simplified) version of Nick Kallen's Retardase Inhibitor, with his blessings. Check this link out for more details:

http://pivots.pivotallabs.com/us...

Comments and changes to this ticket

  • Pratik

    Pratik May 20th, 2008 @ 06:55 PM

    • State changed from “new” to “invalid”

    I don't like the way the patch does UrlWriter.set_default_url_options_from_request(request). We've been trying to remove such changes which requires a mutex around dispatching requests.

    Thanks.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages