Email for every product you ship — send over a verified domain, receive email as a webhook, give an AI agent its own inbox.
A one-command recipe that wires MailKite into a Ploi-managed Laravel site: set the mail env, optionally create an inbound route, done.
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.
Ploi is where a lot of Laravel/PHP devs provision and manage their own VPS sites — a clean, affordable alternative to Forge. Ploi has no built-in email story, but it does expose a site's whole .env over its API. This CLI uses that to add MailKite in one command: it reads the site's .env, splices in the mail configuration, and writes it back. No dashboard clicking, no copy-paste.
Two paths, smtp is the default:
--mode smtp(default) — universal SMTP relay, zero code change. Points Laravel's mailer atsmtp.mailkite.dev.--mode api— the nativemailkite/laravelmailer (MAIL_MAILER=mailkite).
Add --inbound <url> to also create a MailKite inbound webhook route and set MAILKITE_WEBHOOK_SECRET.
npx mailkite-ploi \
--token <ploi-api-token> \
--server <serverId> --site <siteId> \
--mailkite-key mk_live_... \
--from you@yourdomain.com \
[--mode smtp|api] \
[--inbound https://yoursite.com/api/inbound] \
[--dry-run]--token— a Ploi API token from ploi.io/profile/api-keys (or setPLOI_API_TOKEN).--mailkite-key— a MailKite API keymk_live_…from the dashboard (or setMAILKITE_API_KEY).--dry-run— print the.envdiff (and the route that would be created) without writing anything.
Start with --dry-run to preview the change. The --from domain must be verified on your MailKite account (outbound = SPF + DKIM; inbound routing = MX) — this recipe configures the app; the DNS is set on MailKite.
Upserts, into the site .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailkite.dev
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=mk_live_…
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=you@yourdomain.com
MAIL_FROM_NAME=${APP_NAME}Every existing Mail::send() now delivers through MailKite — no code change, no package to install.
Upserts MAIL_MAILER=mailkite, MAILKITE_API_KEY, and MAIL_FROM_*, then triggers a Ploi deploy. The native mailer needs the Laravel package installed — add this line to the site's Deploy Script (Manage Site → Deploy Script) so it runs on every deploy:
composer require mailkite/laravel(Ploi's deploy-script content isn't editable over the API, so this one step is manual; the CLI triggers the deploy for you once the line is in place.)
With --inbound https://yoursite.com/api/inbound, the CLI creates a MailKite route (*@yourdomain.com → webhook) and writes MAILKITE_WEBHOOK_SECRET into the .env. Verify the signature in your app with the mailkite/laravel package (verifyWebhook). Full inbound guide: https://mailkite.dev/docs.
Same contract, every language (full list: https://mailkite.dev/docs/libraries):
| Library | Repo | Distribution |
|---|---|---|
| MailKite for Ploi (this repo) | ploi |
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.