How do I configure devise to use a custom email layout?

holden picture holden · Feb 15, 2011 · Viewed 16.2k times · Source

When I say layout I don't mean just simply the views, I generate those. On all my own mailers I'm using a default layout. Which I define in the SomeMailer.rb file

#some_mailer.rb
class SomeMailer < ActionMailer::Base
  layout 'sometemplate'

Is there some way I can do this for the Devise Mailer et al.?

Answer

holden picture holden · Feb 18, 2011

Found the answer sitting in the Devise Github wiki,

Reading that helps. ;-)

config.to_prepare do
  Devise::Mailer.layout "simple" # simple.haml or simple.erb
  Devise::Mailer.helper :mailer
end

Here is the reference of the wiki page: How To: Create custom layouts