Research
- Action Mailer Basics Show archive.org snapshot and Previews
- Chapter "Task H1: Sending Mail" from Agile Web Development with Rails 7.2 Show archive.org snapshot (in our library)
- Ensure that the receiving e-mail is valid
- Ensure that development and staging are not sending out e-mails by accident
- Ensure that e-mail arrives at the inbox without being blocked
- Read about "E-mail deliverability"
- Skim over Kim's slides about sending mails from linux Show archive.org snapshot
- Learn how we can implement basic e-mail styling (not required for the exercises below)
- Watch the talk " HTML E-Mails mit MJML đź”’ Show archive.org snapshot " (slides)
- Visit
Can I Email
Show archive.org snapshot
. Can you use
flex
styles in E-Mails?border-radius
? Ancient<table>
layouts?
Exercises
- In MovieDB, if you did not implement sending a welcome e-mail, send an e-mail now.
- In MovieDB, whenever someone creates a movie, send a notification to
moviedb-admin@example.com
.- Can you attach the movie's poster as a file attachment to the e-mail?
- Can you write a RSpec test for this?
- In the lesson Form Models we said that we don't like to send e-mails in core model callbacks. We would much rather send e-mails from form model callbacks. Why is that?
- Make sure that MovieDB does not send e-mails from your
Movie
model, but from a form model likeMovie::Form
.
- Make sure that MovieDB does not send e-mails from your
Hint
Action Mailer has a delivery method like
:smtp
or:sendmail
which can be different for each environment. For thetest
environment the delivery method is set to:test
, which means that new e-mails are stored as objects in theActionMailer::Base.deliveries
array. You can inspect this array in your tests.
Discuss
With your mentor, discuss the challenges of implementing HTML mails well.
Posted by Henning Koch to makandra Curriculum (2015-07-08 17:49)