# Custom mail templates

**URL:** <https://www.ruby-forum.com/t/custom-mail-templates/135778>\
**Category:** Rails\
**Created:** [April 24, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/custom-mail-templates/135778 "2008-04-24T22:02:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [April 24, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/custom-mail-templates/135778/1 "2008-04-24T22:02:21Z")

</div>

Hi everyone

I want to tell my ActionMailer to use a different template depending  
on some custom logic. How do I tell ActionMailer to use a different  
template. I have tried using class\_name and used explicit render  
function calls but I cannot get it to work. Does anybody have any  
tips? I should say I am using Rails 1.2.6 as I understand the  
ActionMailer has changed a bit in 2.0.

Kindest regards

Erik L.

---

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [April 25, 2008, 11:22am UTC](https://www.ruby-forum.com/t/custom-mail-templates/135778/2 "2008-04-25T11:22:54Z")

</div>

Hi,

take a look at how Rails deals with multipart messages, specifically the  
render\_message method:  
[Peak Obsession](http://api.rubyonrails.com/classes/ActionMailer/Base.html) - maybe this  
does what you want.

If you need more inspiration, take a look at the Globalize localization  
plugin; they have modified ActionMailer to allow for per-locale email  
templates.

Cheers  
Jan

---

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [April 28, 2008, 8:51am UTC](https://www.ruby-forum.com/t/custom-mail-templates/135778/3 "2008-04-28T08:51:33Z")

</div>

Thanks. I will check it out.

/Erik
