# Layouts in ActionMailer

**URL:** <https://www.ruby-forum.com/t/layouts-in-actionmailer/163123>\
**Category:** Rails\
**Created:** [March 17, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/layouts-in-actionmailer/163123 "2009-03-17T14:09:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [March 17, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/layouts-in-actionmailer/163123/1 "2009-03-17T14:09:30Z")

</div>

Hiya

I am having loads of trouble adding layouts to my emails in rails 2.2.

I created a layout app/views/layouts/notifier.html.erb and this layout  
was used for all my emails regardless of content type. All was well.

But I want to create a different layout for the different content  
types (text/html, text/plain)

In which case I made app/views/layout/notifier.text.html.erb and app/  
views/layouts/notifier.text.plain.erb

as described here

> **[Action Mailer Basics — Ruby on Rails Guides](https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-layouts)**
>
> Action Mailer BasicsThis guide provides you with all you need to get started in sending emails from your application, and many internals of Action Mailer. It also covers how to test your mailers.After reading this guide, you will know: How to send...

class Notifier \< ActionMailer::Base

layout ‘notifier’

def reminder  
…  
content\_type ‘text/html’  
…  
end  
end

Now it won’t render either layout. I get the error

ActionView::MissingTemplate (Missing layout layouts/notifier.erb in  
view path /home/rails/test/app/views:):  
/opt/csw/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_view/  
template.rb:95:in `find\_full\_path’

Has anyone got any ideas?? I’d be very grateful
