Hello, The situation is that opposed to the classic setting (i.e. having an .rhtml file as the email template) the e-mail template I am using to send e-mail should be editable - i.e. there is a first version of the template (in the DB, or as an .rhtml_, it does not matter), which the user can edit from the Rails app, then the edited version should be saved and used to send the email. While I don''t think so this problem was not solved before, I was unable to find anything after heaps of googling - it seems everyone is just using the standard, one-html-for-all method. So what''s the Rails way to do this? Cheers, Peter __ http://www.rubyrailways.com http://scrubyt.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Peter, I would bet that this situation comes up a lot. The best way I''ve found to handle this is to have your template in the DB. You can use ERB to process it like so: email_body = ::ERB.new(email_template.gsub("[{%", "<%").gsub("%}]"," %>"), nil, "").result(binding) The gsubs are used because I recommend using the string [{% instead of <%. This allows you to use a WYSIWYG editor with minimum headache. Given that your making an interface for changing the email templates, one assumes, WYSIWYG is on the agenda too. You still end up with a .rhtml file, but all in contains is <%= email_body %> I''m sure others out there are doing something similar and would love to hear what they do. Good Luck, Rob Kaufman On 8/31/07, Peter Szinek <peter-1qeOAEHAaE2th3+mQRrSYA@public.gmane.org> wrote:> > > Hello, > > The situation is that opposed to the classic setting (i.e. having an > .rhtml file as the email template) the e-mail template I am using to > send e-mail should be editable - i.e. there is a first version of the > template (in the DB, or as an .rhtml_, it does not matter), which the > user can edit from the Rails app, then the edited version should be > saved and used to send the email. > > While I don''t think so this problem was not solved before, I was unable > to find anything after heaps of googling - it seems everyone is just > using the standard, one-html-for-all method. > > So what''s the Rails way to do this? > > Cheers, > Peter > > __ > http://www.rubyrailways.com > http://scrubyt.org > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter, I just finished putting up a blog post, my first, on how I did this. Give it a read and let me know if it helped you at all. http://blog.morwood.com/dynamic-actionmailer-content Cheers, Kevin On Aug 31, 8:02 am, Peter Szinek <pe...-1qeOAEHAaE2th3+mQRrSYA@public.gmane.org> wrote:> Hello, > > The situation is that opposed to the classic setting (i.e. having an > .rhtml file as the email template) the e-mail template I am using to > send e-mail should be editable - i.e. there is a first version of the > template (in the DB, or as an .rhtml_, it does not matter), which the > user can edit from the Rails app, then the edited version should be > saved and used to send the email. > > While I don''t think so this problem was not solved before, I was unable > to find anything after heaps of googling - it seems everyone is just > using the standard, one-html-for-all method. > > So what''s the Rails way to do this? > > Cheers, > Peter > > __http://www.rubyrailways.comhttp://scrubyt.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter, URL correction...because Mephisto is not perfect (yet). http://blog.morwood.com/2007/09/04/dynamic-actionmailer-content Cheers, Kevin On Sep 4, 11:57 am, stretch <ke...-7RRpAkGoqP/Cnp4W7fqMDg@public.gmane.org> wrote:> Peter, > > I just finished putting up a blog post, my first, on how I did this. > Give it a read and let me know if it helped you at all. > > http://blog.morwood.com/dynamic-actionmailer-content > > Cheers, > Kevin > > On Aug 31, 8:02 am, Peter Szinek <pe...-1qeOAEHAaE2th3+mQRrSYA@public.gmane.org> wrote: > > > > > Hello, > > > The situation is that opposed to the classic setting (i.e. having an > > .rhtml file as the email template) the e-mail template I am using to > > send e-mail should be editable - i.e. there is a first version of the > > template (in the DB, or as an .rhtml_, it does not matter), which the > > user can edit from the Rails app, then the edited version should be > > saved and used to send the email. > > > While I don''t think so this problem was not solved before, I was unable > > to find anything after heaps of googling - it seems everyone is just > > using the standard, one-html-for-all method. > > > So what''s the Rails way to do this? > > > Cheers, > > Peter > > > __http://www.rubyrailways.comhttp://scrubyt.org- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---