# Helpers in mailing templates

**URL:** <https://www.ruby-forum.com/t/helpers-in-mailing-templates/105935>\
**Category:** Rails\
**Created:** [June 4, 2007, 8:38pm UTC](https://www.ruby-forum.com/t/helpers-in-mailing-templates/105935 "2007-06-04T20:38:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![plewizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ce7236/32.png) [@plewizard](https://www.ruby-forum.com/u/plewizard)\
**Post date:** [June 4, 2007, 8:38pm UTC](https://www.ruby-forum.com/t/helpers-in-mailing-templates/105935/1 "2007-06-04T20:38:59Z")

</div>

i’m having a problem using custom helpers in mailing templates.  
because action mailer never uses a controller it doesn’t inherit the  
helper module and i sadly can also not use the helpers from the  
controller than calls the deliver method. this seems like a  
shortcoming, not a feature.

anybody come up with a work around. i know you can use rails default  
helpers like truncate, so it must be possible to stuff the custom ones  
somewhere.

thanks for any help.  
lawrence

---

<div class="post-metadata">

**Author:** ![plewizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ce7236/32.png) [@plewizard](https://www.ruby-forum.com/u/plewizard)\
**Post date:** [June 4, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/helpers-in-mailing-templates/105935/2 "2007-06-04T20:48:00Z")

</div>

On Mon, 2007-06-04 at 11:38 -0700, plewizard wrote:

> i’m having a problem using custom helpers in mailing templates.  
> because action mailer never uses a controller it doesn’t inherit the  
> helper module and i sadly can also not use the helpers from the  
> controller than calls the deliver method. this seems like a  
> shortcoming, not a feature.
> 
> anybody come up with a work around. i know you can use rails default  
> helpers like truncate, so it must be possible to stuff the custom ones  
> somewhere.

Try adding:

include ActionView::Helpers::TextHelper  
include ActionView::Helpers::TagHelper  
include ApplicationHelper

to the class, or atleast the ApplicationHelper one. I haven’t tried it,  
but it may work.

–  
Matthew B. :: 607 227 0871  
Resume & Portfolio @ [http://madhatted.com](http://madhatted.com)
