Custom mail templates

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

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

Thanks. I will check it out.

/Erik