The first scroll

Exercise 1 of 6 in chapter 10 · 270 XP · 5 objectives checked by tests

Topics covered: MailerMailerInterfaceEmailMAILER_DSNassertEmailCount

Reservations made on the website are now saved: Pippin added the traveler's email address and the day of the visit to the form. One thing is missing, the house's good manners: a confirmation scroll, sent for every reservation.

Mailer

The Mailer component sends emails through a transport, chosen by the MAILER_DSN variable: smtp://… in production, a service like Mailgun or Brevo, or null://null, which sends nothing at all. That is the case here: no scroll ever really leaves the tavern. So that you can read them, Pippin keeps a copy of every scroll sent in the 📬 Mailbox (/mailbox, in development only).

In the code, you build an Email and hand it over to MailerInterface. The transport changes nothing in the code.

Your mission

  1. After every saved reservation, send a scroll to the given address, with the subject “Your table at the Drunken Dragon”. The text mentions the name, the number of adventurers and the date (September 18, 2026).
  2. Every scroll from the tavern comes from The Drunken Dragon Tavern <tavern@drunken-dragon.me>. Set it once and for all in config/packages/mailer.yaml, not in the controller.
  3. An invalid address is rejected (422), with a message that mentions the “address”.
  4. A rejected reservation sends nothing.

To try it out: book a table in the preview, then open the mailbox.