Previous Lecture Complete and continue  

  70. Contact Mailer File

  • To have our Rails app send out emails, we need to add some code to a Mailer file.
  • This is the default way you can make a Rails app send out emails.


touch app/mailers/contact_mailer.rb


class ContactMailer < ActionMailer::Base
  default to: '[email protected]'
  def contact_email(name, email, body)
    @name = name
    @email = email
    @body = body
    mail(from: email, subject: 'Contact Form Message')


git status
git add .
git commit -m "Added contact form mailer file"
git push origin contact_form