Turning off the layout in ActionMailer?


#1

So I’m happy to see that ActionMailer supports layouts now (it may
have for a while, but I just now realized it).

But I don’t see a way to turn them off selectively or by multipart
type.

For example, if I have a layout that’s really simple in “layouts/
email.html.erb”:

<%= yield %>

I can then use that in my ActionMailer class with a line at the top:
layout ‘email’

But when I use multipart and have an HTML and a PLAIN file, they both
use the layout and thus the plain contains the

tag.

Is there any way to avoid this? or turn it off in certain cases?

Thanks,

-Danimal


#2

Found it: have to monkeypatch but at least it’s simple:
http://blog.kreeti.com/rails/multipart-emails-with-mailer-templates

Hopefully that’ll soon go in as a bug fix. (and maybe it is for 2.3.
I’m still on 2.2.2)

-Danimal

P.S. I posted just in case this helps someone else.