Ruby Forum Ruby on Rails > Custom mail templates

Posted by Erik Lindblad (Guest)
on 24.04.2008 22:02
(Received via mailing list)
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 Lindblad
Posted by Jan Foeh (janfoeh)
on 25.04.2008 11:22
Hi,

take a look at how Rails deals with multipart messages, specifically the 
render_message method: 
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
Posted by Erik Lindblad (Guest)
on 28.04.2008 08:51
(Received via mailing list)
Thanks. I will check it out.

/Erik