# Laravel Mail Via Notifications

> Use when a user needs an email or in-app message: never hand-built Mail from a controller, always a channel-agnostic notification.

- Skill: `techmefr/laravel-mail-via-notifications` (Agent Skill)
- Install (CLI): `npx get-skill add techmefr/laravel-mail-via-notifications`
- Raw SKILL.md: https://api.skillmd.com/api/skills/techmefr/laravel-mail-via-notifications/raw
- Safety review: pending (external: skill-scanner PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: techmefr (https://skillmd.com/u/techmefr)
- Updated: 2026-11-19
- Page: https://skillmd.com/skills/techmefr/laravel-mail-via-notifications

---


# laravel-mail-via-notifications

Narrow trigger extracted from `skills/laravel-conventions` §6.16 and §8.7, so "send the user a
message" routes here directly instead of only through the whole Laravel block.

## When
Writing or reviewing code that sends a user-facing email or in-app message — a controller action,
an action class, a listener reacting to an event.

## Steps
1. **User-facing email or in-app messaging is not the controller's job.** It goes through a
   notification, never a hand-built `Mail::send`/`Mail::to(...)->send(...)` call sitting in a
   controller or action.
2. **One channel-agnostic notification per event**, with the channels chosen per recipient — adding
   an in-app or push channel later becomes a configuration change, not a second copy of the message.
3. **Hand-rolled mail skips what the notification layer already handles**: queueing, locale, and the
   recipient's own channel preferences — each has to be re-implemented by hand once skipped.

## Output / checkpoint
Every user-facing message is dispatched as a notification (`$user->notify(...)` or
`Notification::send(...)`), never a direct `Mail::` call outside a notification's own `toMail()`.

## Guardrails
- A notification's own `toMail()` method is exactly where `Mail`-shaped code belongs — the rule is
  about the call site, not about never touching the mail API.
- The full argument, alongside realtime broadcasting's authorisation question, lives in
  `skills/laravel-conventions` §8 — read it before treating a "quick" hand-built mail as harmless.

- Whether a message is transactional or marketing, the unsubscribe headers it carries and the suppression it
  honours are decided where the notification's mail is built, and the rules for them are in
  `business/email-deliverability-and-sender-requirements-pitfalls` and
  `business/lifecycle-email-program-design-pitfalls`; this block does not restate them.

## Origin
No external source: this is `skills/laravel-conventions` §6.16 and §8.7 extracted to its own trigger.
Written 2026-09-09, same pilot as `laravel-no-db-enums`. The pointer to the two email business blocks was added
2026-10-20.

