Using ActionMailer layouts to set the layout for devise_mailer ? Or a way to set a html layout for actionmailer, possible?

173 views
Skip to first unread message

rubybox

unread,
Jun 6, 2010, 12:26:22 PM6/6/10
to Devise

Would it be possible without changing code in the gem files to set a
layout for the ActionMailer?

Normally one would set in the ActionMailer controller something like
layout "email"
Then have a email.erb.html file inside /shared/layouts so that you
have 1 html layout and include your mail texts inside that.


Is there a way to have with devise:

1) A html template for all mails that devise sends out where the
content of the mails gets inserted
2) A way to store the texts for the mails send out being saved in
file.plain.erb?


I really hate to have to edit all html mails everytime I change
something in the layout

Thanks

rubybox

unread,
Jun 7, 2010, 8:15:15 AM6/7/10
to Devise
Nobody knows?
It must be possible with Devise?

José Valim

unread,
Jun 7, 2010, 8:16:59 AM6/7/10
to plataforma...@googlegroups.com
The same as you would do with a controller. Inside config/environment.rb:

  config.to_prepare do
    DeviseMailer.layout "OMG"
  end

I think the wiki also had other examples.
--
José Valim

Director of Engineering - Plataforma Tecnologia
Know more about us: http://plataformatec.com.br/en/

rubybox

unread,
Jun 14, 2010, 2:54:33 PM6/14/10
to Devise
Worked flawlesly thanks for helping out a ruby newbie Jose

Serguei Cambour

unread,
Aug 1, 2016, 3:18:40 AM8/1/16
to Devise


On Monday, 7 June 2010 14:16:59 UTC+2, José Valim wrote:
The same as you would do with a controller. Inside config/environment.rb:

  config.to_prepare do
    DeviseMailer.layout "OMG"
  end

I think the wiki also had other examples.

Hi José, it didn't work in Rails 4.2.5 with Devise 3.5.2 versions. Any tips on how to acieve that without declaring another Mailer:

class UserMailer < Devise::Mailer 

and poiting to it in devise.rb

config.mailer = 'UserMailer'
 

Thank you.
Reply all
Reply to author
Forward
0 new messages