Add email to a RunCloud web app in one command — point your Laravel/PHP site's mail at a verified domain, and (optionally) receive inbound email as a signed webhook.
A tiny CLI (mailkite-runcloud) that writes the mail env through your site's git deploy script — or prints it for the RunCloud Env Editor.
Docs · Library guide · mailkite.dev · AI agents
Read-only mirror. This repo is a generated, release-time mirror of the MailKite monorepo (the private source of truth) — development doesn't happen here. Install from npm and open issues against the MailKite docs.
RunCloud is different from Forge and Ploi in two ways this tool is built around:
- No
.envAPI. RunCloud exposes no endpoint to set a web app's.envdirectly. So this CLI writes your mail env through the site's git deploy script (which runs on the server and can write.env) when you pass--git, or — with no--git— prints the exact env block for you to paste into the dashboard Env Editor. Both paths produce the same result. - The RunCloud API is Business/Enterprise-only. On Free/Basic plans the API returns 401/403. The CLI checks this up front (
/ping) and, if you're gated, tells you to use the printed env block + Env Editor instead — which needs no API key at all.
No install needed — run it with npx:
npx mailkite-runcloud \
--token <runcloud-api-key> \
--server <serverId> --webapp <webAppId> --git <gitId> \
--mailkite-key mk_live_… \
--from you@yourdomain.com--token— RunCloud API key (Settings → API Key), or setRUNCLOUD_API_KEY. Add--secret(orRUNCLOUD_API_SECRET) to use HTTP Basic (legacy v2); with just a key it uses Bearer (v3).--server/--webapp— RunCloud ids (--siteis an alias for--webapp).--git— the web app's git deployment id. With it, the mail env is written into the deploy script (idempotently, inside a# --- mailkite ---marker block). Without it, the env is only printed for the Env Editor.--mailkite-key— MailKite API key (orMAILKITE_API_KEY).--from—MAIL_FROM_ADDRESS; its domain must be verified in MailKite.
npx mailkite-runcloud --mailkite-key mk_live_… --from you@yourdomain.comThis makes no API calls — it just prints the KEY=value block. Paste it into your web app's Env Editor in the RunCloud dashboard and save.
--mode smtp (default) |
--mode api |
|
|---|---|---|
| How | SMTP relay through smtp.mailkite.dev:587 |
Native mailkite/laravel mailer |
| Code change | none | composer require mailkite/laravel (added to the deploy script in --mode api) |
| Env written | MAIL_MAILER=smtp, MAIL_HOST, MAIL_PORT, MAIL_USERNAME=apikey, MAIL_PASSWORD=<key>, MAIL_ENCRYPTION=tls, MAIL_FROM_* |
MAIL_MAILER=mailkite, MAILKITE_API_KEY, MAIL_FROM_* |
npx mailkite-runcloud --token <key> --server 11 --webapp 22 --git 3 \
--mailkite-key mk_live_… --from you@yourdomain.com \
--inbound https://yoursite.com/api/inboundCreates a MailKite route (*@yourdomain.com → your URL) and adds MAILKITE_WEBHOOK_SECRET to the env block so your app can verify the signature. Inbound requires the domain's MX to be verified — see the inbound guide.
Prints the env, the managed deploy-script block, and what it would do — without any write calls. Great for a review before you commit.
Same contract, every language (full list: https://mailkite.dev/docs/libraries):
| Library | Repo | Distribution |
|---|---|---|
| MailKite for RunCloud (this repo) | runcloud |
npm |
| MailKite for Laravel | laravel |
Packagist |
| MailKite for PHP | mailkite-php |
Packagist |
| MailKite for Node.js | mailkite-node |
npm |
| MailKite for Python | mailkite-python |
PyPI |
| MailKite for Ruby | mailkite-ruby |
RubyGems |
| MailKite for Java | mailkite-java |
Maven Central |
| MailKite for Go | mailkite-go |
Go modules |
| @mailkite/cli | mailkite-cli |
npm |
- 📚 Documentation: https://mailkite.dev/docs
- 📦 This library's guide: https://mailkite.dev/docs/libraries
- 🤖 AI agents (MCP + inbox agents): https://mailkite.dev/docs/ai-agents
- 🌐 Website: https://mailkite.dev
MIT licensed. © MailKite.