rails/rails — pull request #17646 by andyjeffries (2014-11-17 10:47:53+00:00)
Title: Creating mailer layouts by default, including html and body tags

This should reduce the spam score in some spam detection engines (and is good practice like having an application.html.erb generated by default).

It uses the same name as the mailer if the mailer ends in ...Mailer (e.g. NotifierMailer will generate an `app/views/layouts/notifier_mailer.html.erb` layout and no layout line in the `app/mailers/notifier_mailer.rb` class) but if the mailer doesn't end in ...Mailer, then the layout created is prefixed with `mailer_` (to avoid conflicts with other layouts) and a `layout :...` line is added to the mailer class.

There are tests in there, but I don't use Test::Unit so let me know if you want them reworked/tidied up in some way.

The original pull request was #17606 but the author wanted me to take over adding the layout files, as @dhh requested that they not be dealt with directly in the mailer views.