Add MailPit email catching integration - #3913
Draft
youknowriad wants to merge 7 commits into
Draft
Conversation
# Conflicts: # apps/cli/commands/wp.ts # apps/cli/lib/run-wp-cli-command.ts # apps/cli/php-server-child.ts # tools/common/lib/mu-plugins.ts
Resolve conflicts from trunk's CLI refactors (native-PHP worker pool, runtime threading via getSiteRuntime, tsx tooling) while preserving the MailPit email-catching integration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The npm-published CLI ships cross-platform and cannot bake in a native MailPit binary for every OS/arch, so only the publish platform worked. Resolve the bundled (desktop) binary first and otherwise fetch the matching release asset into ~/.studio on first use, mirroring the native PHP binary pattern. Drop the build-time download from the root postinstall so the npm tarball stays lean; desktop packaging still bundles per-platform via forge.config.ts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
For context, I think this is a strong feature, I didn't implement this myself, it's based on @ryanr14's work but I believe we should consider helping moving it forward. I've seen a lot of people request this. It's a gap compared to other tools. |
Contributor
|
Acknowledging that I've seen this, but also that I won't be able to review it until next week. |
sejas
reviewed
Jun 25, 2026
Member
There was a problem hiding this comment.
Riad, thanks for moving this integration forward. I agree that this is a feature many users have requested and it will be useful for them.
I just noticed a couple of things:
- When deleting a site we might want to remove the emails related to it in ~/.studio/mailpit/${siteId}.db and similar files
- Running
nvm use && npm i && npm startwas not enough and resulted inhttp://127.0.0.1:8025/returning an error/empty page. It worked correctly after runningnpm run download-mailpitonce.
I tried reseting the password of admin@localhost.com:


I'll be AFK tomorrow and next week, so I won't be able to review or help with this PR until I come back.
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.
Related issues
Closes #24
How AI was used in this PR
This PR was opened with AI assistance to surface and revive existing work: an agent located the dormant
add-mailpit-integrationbranch, mapped the implementation against Studio's two PHP runtimes, identified gaps, and drafted this description. The implementation itself is entirely @ryanr14's — all commits are authored by him and unchanged. No AI-generated code has been added on top.Proposed Changes
Adds local email testing to Studio, so messages sent by a site never leave the machine and can be inspected in a real inbox UI — the capability Studio is missing compared with tools like Local and Cove.
wp_mail()messages (recipients, CC/BCC/Reply-To, custom headers, HTML/text body, attachments) are captured and routed to the local Mailpit inbox instead of being delivered.Known gaps before this is merge-ready
studio mailcommand; the inbox isn't referenced insite status) — capture works headless but is only discoverable from the desktop app.trunkmovement (incl. CLI subcommand restructuring) and needs a rebase + full typecheck/test pass.Testing Instructions
npm run download-mailpit(or a fullnpm install) to fetch the Mailpit binary for your platform.studio wp eval 'wp_mail("to@example.com","Hello","Body");').Pre-merge Checklist
🤖 Generated with Claude Code