Hello Guys, Very new to Rails an enjoying myself a great deal. Been playing around with the ActionMailer today sending emails. I''m currently sending a multipart email using the naming conventions for my views to send both an HTML and a TEXT version of the content. contact.text.html.erb contact.text.plain.erb and this is working just perfectly. What I''m now looking to do is apply a layout to the HTML emails that are sent from the system, so that all have a uniform look and feel. I understand how I can apply a layout to a standard HTML view which gets rendered in the browser but I''m struggling to figure out how this can be done, if at all, for HTML emails. I''d appreciate any help you can offer, if you need any more information then please let me know. Thanks, Robert -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello All, I''ve been looking into this a little more this morning and found this in the docs http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-layouts This suggests that I should be able to create a layout file with a certain naming convention that should be picked up when the mail is rendered. My mailer class i defined like this: http://pastebin.com/BQ0n6Fm4 I''ve then created the layout /layouts/ notifications_mailer.text.html.erb However, when sending the mails the layout is still not picked up. I''m not receiving any error messages either. I appreciate any further input people can offer. Thanks, Robert On Jul 16, 11:53 am, Rawlins <rob...-TdvuNkkL3CoN+CoZ0mIrfw@public.gmane.org> wrote:> Hello Guys, > > Very new to Rails an enjoying myself a great deal. Been playing around > with the ActionMailer today sending emails. I''m currently sending a > multipart email using the naming conventions for my views to send both > an HTML and a TEXT version of the content. > > contact.text.html.erb > contact.text.plain.erb > > and this is working just perfectly. What I''m now looking to do is > apply a layout to the HTML emails that are sent from the system, so > that all have a uniform look and feel. > > I understand how I can apply a layout to a standard HTML view which > gets rendered in the browser but I''m struggling to figure out how this > can be done, if at all, for HTML emails. > > I''d appreciate any help you can offer, if you need any more > information then please let me know. > > Thanks, > > Robert-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 Robert, On Sat, Jul 17, 2010 at 7:18 AM, Rawlins <robert-TdvuNkkL3CoN+CoZ0mIrfw@public.gmane.org> wrote:> Hello All, > > I''ve been looking into this a little more this morning and found this > in the docs http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-layouts > > This suggests that I should be able to create a layout file with a > certain naming convention that should be picked up when the mail is > rendered. > > My mailer class i defined like this: http://pastebin.com/BQ0n6Fm4 > > I''ve then created the layout /layouts/ > notifications_mailer.text.html.erb > > However, when sending the mails the layout is still not picked up. I''m > not receiving any error messages either.Have you tried explicitly specifying the layout in your mailer class? layout ''notifications'' Best regards, Bill -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello Bill, I''ve now solved the issue, although still confused. I followed your advice of adding the explicite statement but simply got an error saying that /layouts/notifications.erb was no present. I then removed the explicite statement and changes the name of my layout (contradictory to the docs) from: /layouts/notifications_mailer.text.html.erb to /layouts/notifications.text.html.erb and it all sprung into life and appears to be working just fine! go figure! :-s My only guess is that the docs is based on the assumption that my mailer class is called NotificationsMailer and not just Notifications? Either way the docs confused me a little, however, with your help I''m now up and running. Thanks, Robert On Jul 17, 1:26 pm, Bill Walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Robert, > > > > > > On Sat, Jul 17, 2010 at 7:18 AM, Rawlins <rob...-TdvuNkkL3CoN+CoZ0mIrfw@public.gmane.org> wrote: > > Hello All, > > > I''ve been looking into this a little more this morning and found this > > in the docshttp://guides.rubyonrails.org/action_mailer_basics.html#action-mailer... > > > This suggests that I should be able to create alayoutfile with a > > certain naming convention that should be picked up when the mail is > > rendered. > > > My mailer class i defined like this:http://pastebin.com/BQ0n6Fm4 > > > I''ve then created thelayout/layouts/ > > notifications_mailer.text.html.erb > > > However, when sending the mails thelayoutis still not picked up. I''m > > not receiving any error messages either. > > Have you tried explicitly specifying thelayoutin your mailer class? > > layout''notifications'' > > Best regards, > Bill-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.