Repository navigation
feat(mails): pass custom headers through the mail queue - #13851
Conversation
Mail::headers rides the queue payload (Base64 JSON) so the Mails worker can hand List-Unsubscribe and other custom headers to Messages\Email. Pins utopia-php/messaging to the unmerged feat/messaging-email-headers branch via a dev alias (2.4.999) since the release carrying the headers arg isn't tagged yet; swap for a tagged ^2.5 once it ships.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified, and compatibility and test coverage are included.
Review effort: Lite
Findings: None
What changed in this PR
Adds optional custom email headers to queued mail messages and forwards them through the mail worker.
Changes:
- Adds backward-compatible header serialization.
- Passes headers to outgoing email messages.
- Updates the messaging dependency and tests.
| File | Description |
|---|---|
tests/unit/Event/Message/MailTest.php |
Tests header persistence and legacy payload compatibility. |
src/Appwrite/Platform/Workers/Mails.php |
Forwards headers to email messages. |
src/Appwrite/Event/Message/Mail.php |
Adds header queue serialization support. |
composer.lock |
Locks the updated messaging dependency. |
composer.json |
Requires messaging 2.5+. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Adds a generic
headersfield toEvent\Message\Mail. The Mails worker passes it toMessages\Emailfrom utopia-php/messaging 2.5. Payloads queued without the key decode to[]. A malformed header throws messaging'sheader_malformed: that covers CR/LF, a name the message owns, or a name that duplicates another by case. The existing catch then marks the mail skipped without retrying it.Appwrite Cloud uses this to send RFC 8058
List-Unsubscribe/List-Unsubscribe-Postheaders on non-essential console mail.Bumps
utopia-php/messagingto^2.5, which addsEmailheaders support (utopia-php/monorepo#328). Only messaging moves in the lock.Tests:
Related draft PRs: