Setting up a mailer is a relatively straightforward task. It’s very similar to building a new controller and views. Once you’ve made a couple, it should come naturally.
You’ll be dusting off your Flight Booker project (or one of the other projects that has users registering) and having it send out a “You have booked your ticket” email to all Passengers when they are created as part of the booking process.
$ rails generate mailer PassengerMailer
.letter_opener
gem (see docs here) to open your emails in the browser instead of sending them in the development environment..html.erb
and .text.erb
version of your thank you ticket email.letter_opener
should open it in the browser for you if you’ve set it up properly).Try out one other trick – call the mailer directly from the Rails Console using something like:
> PassengerMailer.thank_you_email(Passenger.first).deliver_now!
This section contains helpful links to other content. It isn’t required, so consider it supplemental for if you need to dive deeper into something.
5-6 months
Job Guarantee
1-on-1 Mentorship