Ruby on Rails ActionMailer Generating a new mailer


To generate a new mailer, enter the following command

rails generate mailer PostMailer 

This will generate a blank template file in app/mailers/post_mailer.rb named PostMailer

class PostMailer < ApplicationMailer

Two layout files will also be generated for the email view, one for the html format and one for the text format.

If you prefer not to use the generator, you can create your own mailers. Make sure they inherit from ActionMailer::Base