The eight drip emails and their eight send jobs were near copy-paste. Every
mailable repeated the same constructor, $tries/$backoff, drip_from envelope,
markdown+userName content and RateLimited middleware, differing only in subject
and template (plus a reply-to on one and an extra view var on another). Every job
repeated the canReceiveEmails/hasReceivedEmail guards, the Mail::send call and the
UserMailLog::create block, differing only in the email type, the mailable, and a
handful of per-email eligibility checks.
Introduce two abstract bases:
- DripMail owns the shared mailable shape; subclasses declare dripSubject() and
template(), with optional contentData() (PromoCode's promo code) and
repliesToSender() (PaywallFollowUp) hooks.
- SendDripEmailJob owns the shared handle() flow; subclasses declare emailType()
and buildMail(), with an optional shouldSend() hook for the per-email
eligibility rules (pro-plan, onboarding, transactions, AI consent, ...).
Each mailable drops from ~68 to ~13 lines and each job from ~48 to ~18, with the
shared send/log logic now living in one place.
Behavior unchanged: subjects, from/reply-to, queue, rate limiting, templates,
view data and every eligibility guard are preserved. Full suite green
(1868 passing, 0 failing) and drip job/command/listener tests pass (71/71).