Repository navigation
feat(messaging): deliver email messages to raw email addresses - #12675
Conversation
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Add an `emails` parameter to the create and update email message endpoints so a message can be delivered to plain email addresses that are not backed by an Appwrite user, target, or topic. The addresses are stored alongside the other email-only fields (cc, bcc, attachments) in the message `data`. The worker streams them straight to the default email provider in bounded pages, skipping the target/subscriber lookups since raw emails are already delivery identifiers. A message addressed only to raw emails now satisfies the recipient requirement. Co-Authored-By: Claude Opus 4.8 <[email protected]>
48b6759 to
3cdceba
Compare
Dedupe the raw email list before chunking so a repeated address that spans two pages is delivered to once, not once per chunk. Add a regression test covering the cross-page case. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The email message routes moved to the Messaging module, so port the emails
parameter, the recipient guard and the data payload onto
Modules/Messaging/Http/Messages/Email/{Create,Update}.php. Accept main's
removal of tests/unit/Messaging/MessagingFanoutTest.php (dropped on main as
implementation-coupled); the raw-email fan-out stays covered by the
MessagingBase E2E tests.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
AssertEqualsToSameRector rewrites the deliveryErrors count assertion; the Checks job runs rector in dry-run mode and failed on the diff. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolve the email Create/Update routes and the messaging worker toward main's shape: main reordered the Create action parameters and changed streamRecipients to yield [page, perUser] tuples keyed identifier => userId, so raw emails now yield an addressed page mapping each address to an empty user id on the default provider. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take main's database 8 rename (getMaxUidLength, Id) in the email routes and re-add the emails param alongside it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SendGrid delivery test only ran when an operator supplied a real DSN, so CI never exercised the worker path and the credentialed run hit a production third-party service. A fresh project whose only provider is the local maildev SMTP server makes that provider the default raw emails route to, so delivery and deduplication of a repeated address are asserted on every run. Also cover the update route, and name emails in the missing recipient error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🟢 Tier S · Ready to merge
Adds raw email-address recipients to email message create and update endpoints, persists them with email message data, and delivers them through the messaging worker. E2E coverage exercises recipient validation, updates, and delivery, while the SDK parameter lock and missing-recipient error description reflect the new API contract. Latest changes: The latest commits move
📂 Walkthrough · 6
Reviewed the commits since |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
|
@greptileai review |
SDKs pass arguments positionally, so inserting emails after targets would shift cc, bcc and every later argument in existing createEmail and updateEmail calls. Declaring it last and appending it to the parameter lock keeps released call sites working. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
Adds an
emailsparameter to the create (POST /v1/messaging/messages/email) and update (PATCH /v1/messaging/messages/email/:messageId) email message endpoints. It accepts a list of plain email addresses, letting a message be delivered to recipients that are not backed by an Appwrite user, target, or topic.Why
Today an email message can only target Appwrite-managed recipients (topics, users, or targets). Sending a one-off email to an arbitrary address required first creating a user/target. The
emailsparam removes that requirement.How
src/Appwrite/Platform/Modules/Messaging/Http/Messages/Email/{Create,Update}.php): newemailsparam validated withArrayList(new Email()), declared last and appended toapp/config/sdks/parameters.lock.jsonso existing positional SDK calls keep their argument order. The addresses are stored alongside the other email-only fields (cc,bcc,attachments) in the messagedata, so no schema migration is needed. The "missing recipient" guard treats a non-emptyemailslist as a valid recipient source on both create and update, and themessage_missing_targeterror description now names emails.src/Appwrite/Platform/Workers/Messaging.php):sendExternalMessagereadsdata.emailsand threads it intostreamRecipients, which yields the raw addresses in bounded pages (MESSAGE_RECIPIENTS_PAGE_SIZE) as addressed[page, true]tuples on the default provider, each address mapped to an empty user id (main'sidentifier => userIdpage shape). Raw emails skip the target/subscriber lookups entirely and are deduplicated before chunking, so a repeated address spanning two pages is delivered once. Mixed messages (e.g. a topic plus raw emails) are supported.Tests
E2E (
tests/e2e/Services/Messaging/MessagingBase.php):testCreateEmailToRawEmails: raw emails alone satisfy the recipient requirement, are persisted indata.emails, and malformed addresses are rejected with400.testUpdateEmailToRawEmails:emailscan be set on a draft via PATCH (otherdatafields preserved), malformed addresses are rejected, and clearing every recipient while un-drafting returnsmessage_missing_target.testSendEmailToRawEmails: full delivery through the worker against the local maildev SMTP server in a fresh project (so maildev is the default provider). Sends to one address listed twice and assertsSENT,deliveredTotal === 1, no delivery errors, and receipt in maildev. Runs on every CI run; no third-party service is called.Verification
src/Appwrite/Platform/Workers/Messaging.php,src/Appwrite/Platform/Modules/Messaging,tests/e2e/Services/Messaging: no errorstests/tools/rector.php) on the test file: cleanNot verified locally
emails. The messagedatacolumn is 65535 chars; an oversized payload fails the document structure check, which the general error handler maps togeneral_argument_invalid(400), the same as an oversizedcc/bcclist today.🤖 Generated with Claude Code