Building an email sending feature

In this lesson, we build out milestone three — the ability to share bookmarks via email — and use it as the moment to introduce a more professional Git workflow. Instead of building directly on the main branch like we did in the first two milestones, we create a dedicated email-sending branch, do all our work there, and then go through the process of opening a pull request and merging it into main on GitHub. You'll see Claude Code plan and implement the mailer, controllers, routes, and modal share form, and we test it locally using the letteropener gem to inspect the actual generated emails. We also dig into a real product trade-off: should the email send in the main thread (`delivernow) or via a background job (deliver_later`)? I'll show you how to ask Claude for the trade-offs and make an informed call. Resend integration for production sending is deferred to module four, where we'll handle deployment.

In this lesson:

  • Why and when to switch from working on main to a feature branching strategy
  • Asking Claude Code to create and check out a new branch (email-sending)
  • Using the milestone three prompt and dropping into plan mode
  • Answering Claude's UX questions: modal vs. dedicated page, toast vs. banner confirmation
  • Reviewing the implementation plan for mailers, routes, and front-end pieces
  • Watching Claude write automated tests alongside features (and running rails test)
  • Testing email sending locally with the letteropener gem at `/letteropener`
  • Customizable subject and body, with link and AI summary pre-populated
  • Setting reply_to to the account owner's email so replies route correctly
  • Trade-off discussion: deliver_now vs. deliver_later for one-off user-initiated emails
  • Demonstrating branch isolation by switching between main and email-sending locally
  • Committing to the feature branch, pushing to GitHub, opening a PR, and merging into main
  • Pulling the merged main branch back down locally
← Back to library