Generating a new mailer
suggest changeTo generate a new mailer, enter the following command
rails generate mailer PostMailer
This generates the mailer class app/mailers/post_mailer.rb:
class PostMailer < ApplicationMailer
end
It also generates HTML and text mailer layouts. Action templates go in app/views/post_mailer/, and only when you pass action names to the generator. rails generate mailer PostMailer with no actions does not create those templates.
If you prefer not to use the generator, you can create your own mailers. Inherit from ApplicationMailer, which inherits from ActionMailer::Base.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents