Layout on Email

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.


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.



Hello All,

I've been looking into this a little more this morning and found this
in the docs

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

My mailer class i defined like this:

I've then created the layout /layouts/

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.



Hi Robert,

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:




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

Either way the docs confused me a little, however, with your help I'm
now up and running.