Change mailer layout in method
The mail
method can take a block that passes in a format object.
class MyMailer < ApplicationMailer
layout 'mailer'
def password_reset(user)
# uses the "mailer" layout
end
def special
mail(to: "whomever") do |format|
format.html { render(layout: false) } # no layout is used
format.text # use the special.text.erb like normal
end
end
end
This article answer to your question. Just specify :layout
option in render
method.