Help for ActionMailer!

Hello,

I have a big problem und hoping for your help.

In my application a user should be able to edit an email template file for himself and send it out e.g. to a customer. (thats the plan).

For that I have created some functionality to edit the template file and an ActionMailer class with a method called 'createMail'. The user is editing the template file, saves the file and then he is sending the mail to the customer. Thats working fine. But now the user is making changes on the template file and he wants to send it out again. And now my problem comes up. The result of createMail() is the same as it was for the first time. The changes, the user has made in the template file are not in the created email.

I think that has something to do with caching. Because all is working well in the development environment but not in production.

Is there anyone who can help. Is there a possibility to force the system to use the newer version of the template file and not to be 'proud' of an old file.

If I can get any help you will get an invitation to the octoberfest in munich/bavaria/germany later this year :slight_smile:

Best regards Klaus Kohlbauer

infosense gmbh Infanteriestrasse 19/5 80797 München Telefon Büro: +49 89 12 11 35 59 Telefon Mobil: +49 173 999 777 9 Email: klaus.kohlbauer@infosense.de Web: www.infosense.de

You might be interested in http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1119127159435e5c They're talking about actioncontroller views rather than actionmailer views but it's all the same really.

What I've done in the past is just sidestep this completely with a mailer method like this:

  def standard_email(recipient, template)     setup_common(recipient)     @subject = template.subject     @body = Liquid::Template.parse(template.body).render({})   end

template is an activerecord object holding the body, subject etc. of the message. I happened to use Liquid to render the message, but that's up to you. You could read templates from disk rather than from database.

Fred

Sound good - I will try it. Thanks. Klaus Kohlbauer