Open clarkngo opened 5 years ago
Do i need to follow this documentation (https://edgeguides.rubyonrails.org/action_mailer_basics.html and) create the mailer first (rails generate mailer UserMailer
)?
No, I recommend using the link here because edgeguides
refers to Rails 6 beta at this time. Next, you're correct that you can use rails generate mailer UserMailer
. However, you shouldn't be writing mailer specs. They should be removed if these files are generated.
rails generate mailer UserMailer
outputs:
create app/mailers/user_mailer.rb
create app/mailers/application_mailer.rb
invoke erb
create app/views/user_mailer
create app/views/layouts/mailer.text.erb
create app/views/layouts/mailer.html.erb
invoke test_unit
create test/mailers/user_mailer_test.rb
create test/mailers/previews/user_mailer_preview.rb
I should remove the following files?
test/mailers/user_mailer_test.rb
test/mailers/previews/user_mailer_preview.rb
@clarkngo There's no need to create a UserMailer
here because this functionality exists within Devise
. Thus, I recommend that you review Devise
docs.
config/initializers/mail.rb
file to hold your e-mail settings for development, test, and production environments. Please read sections 6, 7, and 8.