Repository navigation
[Website] Forward captured sendmail messages - #4103
Merged
Merged
Conversation
bgrgicak
marked this pull request as ready for review
July 20, 2026 08:25
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR forwards captured sendmail events from PHP instances into the website client state and parses RFC 822 messages so website components can consume structured email data.
Changes:
- Forward
sendmail.spawnedevents throughPlaygroundWorkerEndpoint. - Parse captured email streams with
postal-mimeand store parsed messages in per-siteclientInfo.emails. - Relax Redux serializability checks for parsed email objects and wiring needed in tests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/src/lib/state/redux/store.ts | Excludes email payload/state paths from serializability checks. |
| packages/playground/website/src/lib/state/redux/slice-clients.ts | Adds emails to client state and introduces addClientEmail reducer. |
| packages/playground/website/src/lib/state/redux/boot-site-client.ts | Listens for sendmail.spawned, parses stream, dispatches addClientEmail. |
| packages/playground/website/src/lib/state/redux/boot-site-client.spec.ts | Updates test client stub with addEventListener. |
| packages/playground/remote/src/lib/sendmail-transport.spec.ts | Updates PHP mock to include addEventListener. |
| packages/playground/remote/src/lib/playground-worker-endpoint.ts | Re-dispatches sendmail.spawned from PHP to the worker endpoint. |
| package.json | Adds postal-mime dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bgrgicak
marked this pull request as ready for review
July 24, 2026 17:54
mho22
approved these changes
Aug 13, 2026
mho22
added a commit
that referenced
this pull request
Aug 13, 2026
## Summary Adds an Email panel to the Playground Site Manager for viewing messages captured from the active site, including message and attachment previews. ## Motivation for the change, related issues Builds on #4103 and #3996 to make captured `sendmail` messages available in the Site Manager UI. Related issue: #3994. ## Implementation details - Reads parsed messages from the active site's `clientInfo.emails` array and selects the newest message by default. - Displays message metadata and HTML or plain-text content. HTML and attachment-bearing messages render in a no-referrer, sandboxed iframe; links open outside the preview, while scripts and forms remain blocked. - Resolves `cid:` images and attachments to temporary Blob URLs, with image, video, and audio previews and downloads. URLs are revoked when no longer needed. - Uses `@wordpress/components` for the message list, empty state, and metadata. Attachment cards use isolated styles in a declarative shadow root. - Keeps messages in memory for the site client's lifetime. Aggregate retention is unbounded, there is no clear-mailbox action, and messages are discarded when the client restarts or is removed, or the page reloads. - Adds Playwright coverage that sends mail through PHP and verifies the captured subject and body in the Email panel. ## Testing Instructions 1. Start the website with `npm run dev`. 2. Open the [local Playground website with this Blueprint](http://127.0.0.1:5400/website-server/?blueprint-url=https%3A%2F%2Fgist.githubusercontent.com%2Fbgrgicak%2Ff4d2cc7242fceef00bd0109fb8b81137%2Fraw%2Femail-test-blueprint.json). 3. Open **Email** in the Site Manager and confirm the empty state is shown. 4. Select **Send test email** in the site's admin bar. 5. Confirm the message metadata, HTML, special characters, images, and external links render correctly. 6. Confirm supported attachments can be previewed and all attachments can be downloaded. <img width="1839" height="1324" alt="Email panel showing a captured message" src="https://github.com/user-attachments/assets/9c560378-dac4-4fd3-8895-e87c7d1d76ba" /> --------- Co-authored-by: mho22 <yannick@capsules.codes>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Forwards captured
sendmailmessages through the Playground client and stores parsed messages in each site's website state for the inbox UI planned in #4000 as part of #3994.Rationale
Email capture currently stops inside the PHP worker. Website components need structured messages they can consume. This PR adds that plumbing only; it does not add an inbox UI or deliver mail to the internet.
Implementation details
sendmail.spawnedfrom each PHP instance while avoiding duplicate forwarding listeners on reused instances.stdinstream crosses both Comlink hops, then parses messages withpostal-mime.clientInfo.emails, preserving newest-first event order. Parse failures do not block later messages.emailsand excludes parsed email objects from Redux serializability checks.Capture starts after
startPlaygroundWeb()completes, so mail sent during initial boot or Blueprint execution is not retained. Messages are held only in memory and are discarded when the client restarts, is removed, or the page reloads. Each source message is limited to 20 MiB, but aggregate retention remains unbounded until the inbox UI adds an eviction policy.Testing Instructions