Skip to content

Repository files navigation

MailKite

MailKite for RunCloud

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

npm

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.

⚠️ Read this first (RunCloud specifics)

RunCloud is different from Forge and Ploi in two ways this tool is built around:

  1. No .env API. RunCloud exposes no endpoint to set a web app's .env directly. 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 --gitprints the exact env block for you to paste into the dashboard Env Editor. Both paths produce the same result.
  2. 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.

Install / run

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 set RUNCLOUD_API_KEY. Add --secret (or RUNCLOUD_API_SECRET) to use HTTP Basic (legacy v2); with just a key it uses Bearer (v3).
  • --server / --webapp — RunCloud ids (--site is 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 (or MAILKITE_API_KEY).
  • --fromMAIL_FROM_ADDRESS; its domain must be verified in MailKite.

No Business/Enterprise plan? Skip the token.

npx mailkite-runcloud --mailkite-key mk_live_… --from you@yourdomain.com

This 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.

Two mail paths

--mode smtp (default)--mode api
HowSMTP relay through smtp.mailkite.dev:587Native mailkite/laravel mailer
Code changenonecomposer require mailkite/laravel (added to the deploy script in --mode api)
Env writtenMAIL_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_*

Receive inbound email (--inbound)

npx mailkite-runcloud --token <key> --server 11 --webapp 22 --git 3 \
--mailkite-key mk_live_… --from you@yourdomain.com \
--inbound https://yoursite.com/api/inbound

Creates 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.

--dry-run

Prints the env, the managed deploy-script block, and what it would do — without any write calls. Great for a review before you commit.

All MailKite libraries

Same contract, every language (full list: https://mailkite.dev/docs/libraries):

LibraryRepoDistribution
MailKite for RunCloud (this repo)runcloudnpm
MailKite for LaravellaravelPackagist
MailKite for PHPmailkite-phpPackagist
MailKite for Node.jsmailkite-nodenpm
MailKite for Pythonmailkite-pythonPyPI
MailKite for Rubymailkite-rubyRubyGems
MailKite for Javamailkite-javaMaven Central
MailKite for Gomailkite-goGo modules
@mailkite/climailkite-clinpm

Docs & links

MIT licensed. © MailKite.

About

MailKite for RunCloud — one-command CLI to wire MailKite email into a RunCloud web app.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages