whisper-money/app/Mail
Víctor Falcón 934d834ab3
feat(email): follow up after post-onboarding AI consent (#596)
## What

Adds a lifecycle email sent **2 days after a user records AI consent**,
but only when that consent was given **outside of onboarding** — i.e.
more than 3 days after sign-up. This targets users who deliberately
opted into AI later (e.g. via the billing toggle / transactions banner
gated by the `AiConsentSettings` flag), not those who consented during
initial setup.

## How

- **`email:ai-consent-follow-up`** scheduled command (daily, 10:15
Europe/Madrid) selects active consents accepted exactly 2 days ago,
skips onboarding-era ones (`accepted_at <= created_at + 3 days`), and
queues a job per user.
- **`SendAiConsentFollowUpEmailJob`** sends the mailable and records a
`UserMailLog`. Dedup, locale and the queued-email plumbing all reuse the
existing drip system — **no migration**.
- Email is localised automatically via the user's `HasLocalePreference`,
like every other drip email.

## Design notes

- **Scheduled command, not a 2-day delayed job** — survives worker
restarts and respects consent revoked in the meantime.
- **Exact "2 days ago" window**, matching the existing paywall drip. If
the scheduler misses a day that cohort isn't retried; kept consistent
with the other drips on purpose.
- Copy is a first draft — open to wording tweaks.

## Tests

`tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php` — 9 tests
covering the happy path, onboarding exclusion (incl. the exact-3-days
boundary), timing window, revoked consent, the disabled-drip gate,
single-send + mail log, no-resend, and locale rendering. All green, Pint
clean.
2026-06-26 17:56:06 +00:00
..
Drip feat(email): follow up after post-onboarding AI consent (#596) 2026-06-26 17:56:06 +00:00
BankTransactionsSyncedEmail.php fix: make transaction sync email use default sender (#265) 2026-04-07 13:50:42 +01:00
BankingConnectionAuthFailedEmail.php fix: split drip and default email senders (#263) 2026-04-06 12:16:47 +02:00
BankingConnectionExpiredEmail.php Notify users about expired bank connections (#404) 2026-05-20 09:20:13 +02:00
BrokenBankLogosReportEmail.php fix: split drip and default email senders (#263) 2026-04-06 12:16:47 +02:00
EnableBankingConnectionsCancelledEmail.php Cancel Enable Banking connections for free users (#289) 2026-04-15 16:23:03 +02:00
UpdateEmail.php fix: split drip and default email senders (#263) 2026-04-06 12:16:47 +02:00
UserLeadInvitation.php feat(leads): cohort-based launch invitations with per-user Stripe coupons (#333) 2026-04-30 15:10:28 +01:00
UserLeadReInvitation.php feat(leads): add user lead re-invite campaign (#432) 2026-05-26 08:35:31 +02:00
WaitlistOvertaken.php feat: selective retry of failed lead email jobs (#286) 2026-04-15 08:00:29 +01:00
WaitlistReferralNotification.php feat: selective retry of failed lead email jobs (#286) 2026-04-15 08:00:29 +01:00
WaitlistWelcome.php feat: selective retry of failed lead email jobs (#286) 2026-04-15 08:00:29 +01:00