Raymond O''Connor
2009-Mar-06 00:55 UTC
ActionMailer Layout on HTML version not Plain Text
I''m sending plain text and html emails by having multiple files for each email I send. For example, for my registration email I have a registration.text.plain.erb file and a registration.text.html.erb file. I want to use a layout for the html version of my emails. In my mailer I put: class AccountsMailer < ActionMailer::Base layout ''email'' ... end Unfortunately rails seems to look for views/layouts/email.html.erb and uses that layout for both my HTML and plain text emails. When I name the file email.text.html.erb rails complains: Missing layout layouts/email.erb ... How do I set up action mailer so that it uses a layout only for the html version of emails? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Raymond O''Connor
2009-Mar-10 11:25 UTC
Re: ActionMailer Layout on HTML version not Plain Text
Is there really no way to do this? This pretty much makes actionmailer layouts useless if you are sending html emails with plain text alternatives. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Did you ever find an answer to this? I have the exact same problem. http://guides.rubyonrails.org/action_mailer_basics.html claims you can use different content types (plain/html) but it doesn''t work for me On Mar 10, 11:25 am, Raymond O''Connor <rails-mailing-l...@andreas- s.net> wrote:> Is there really no way to do this? This pretty much makes actionmailer > layouts useless if you are sending html emails with plain text > alternatives. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi! I just posted the exact same issue here before I saw this thread. It doesn''t work for me on Rails 2.2.2. I was really excited to see layouts in ActionMailer, but this is frustrating. *sigh* -Danimal (I''m poking around in the ActionMailer code to see if there is anything I can find) On Mar 17, 3:53 am, Iain Adams <iain.adams.1...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Did you ever find an answer to this? I have the exact same problem. > > http://guides.rubyonrails.org/action_mailer_basics.html > > claims you can use different content types (plain/html) but it doesn''t > work for me > > On Mar 10, 11:25 am, Raymond O''Connor <rails-mailing-l...@andreas- > > s.net> wrote: > > Is there really no way to do this? This pretty much makes actionmailer > > layouts useless if you are sending html emails with plain text > > alternatives. > > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
BTW, looks like this has been a known bug for a little while: https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts (since January at least). *sigh* Hopefully someone will fix it. If I knew the internals of Rails better, I''d give it a go myself. -Danimal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Woo hoo! Fix discovered! http://blog.kreeti.com/rails/multipart-emails-with-mailer-templates Whew! I wasted 4 hours last night trying to monkeypatch ActionMailer but I was futzing around in the wrong places. I added Surendra''s suggestion as a monkeypatch and it works great! Ok, on to other stuff... -Danimal On Mar 25, 11:02 pm, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> BTW, looks like this has been a known bug for a little while:https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmail... > > (since January at least). > > *sigh* > > Hopefully someone will fix it. If I knew the internals of Rails > better, I''d give it a go myself. > > -Danimal--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---