397 Rails: Sending e-mail [2d]

Posted Almost 9 years ago. Visible to the public.

Research

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 a text file (any content) to the e-mail?
    • Can you write a RSpec test for this?
    • Hint: Action Mailer has a delivery method like :smtp or :sendmail which can be different for each environment. For the test environment the delivery method is set to :test, which means that new e-mails are stored as objects in the ActionMailer::Base.deliveries array. You can inspect this array in your tests.
  • 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 like Movie::Form.

Discuss

With your mentor, discuss the challenges of implementing HTML mails well.

Henning Koch
Last edit
2 months ago
Michael Leimstädtner
Keywords
email
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra Curriculum (2015-07-08 17:49)