# Runner: url\_for with mailers impossible

**URL:** <https://www.ruby-forum.com/t/runner-url-for-with-mailers-impossible/69417>\
**Category:** Rails\
**Created:** [February 16, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/runner-url-for-with-mailers-impossible/69417 "2006-02-16T22:10:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [February 16, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/runner-url-for-with-mailers-impossible/69417/1 "2006-02-16T22:10:13Z")

</div>

I created a runner script to send a newsletter. I found this hack where  
you pass a controller and specify a helper:

[http://wiki.rubyonrails.org/rails/pages/HowtoUseUrlHelpersWithActionMailer](http://wiki.rubyonrails.org/rails/pages/HowtoUseUrlHelpersWithActionMailer)

But in a runner script there is no controller to pass. So, it looks like  
it’s impossible to use url\_for in the mailer template this way.

Another way around the no url\_for problem is to pass the generated url  
to the mailer, but again there is no controller in runner scripts.

Impossible?

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 29, 2006, 11:27pm UTC](https://www.ruby-forum.com/t/runner-url-for-with-mailers-impossible/69417/2 "2006-03-29T23:27:16Z")

</div>

Joe (or anyone else),

Did you ever find a solution to this problem? Thanks.

Ben

Joe wrote:

> I created a runner script to send a newsletter. I found this hack where  
> you pass a controller and specify a helper:
> 
> [http://wiki.rubyonrails.org/rails/pages/HowtoUseUrlHelpersWithActionMailer](http://wiki.rubyonrails.org/rails/pages/HowtoUseUrlHelpersWithActionMailer)
> 
> But in a runner script there is no controller to pass. So, it looks like  
> it’s impossible to use url\_for in the mailer template this way.
> 
> Another way around the no url\_for problem is to pass the generated url  
> to the mailer, but again there is no controller in runner scripts.
> 
> Impossible?
> 
> Joe
