Add MailKite email to a Forge site in one command — send over a verified domain (SMTP relay or the native Laravel mailer) and receive inbound email as a signed webhook.
A tiny CLI that reads your site's .env over the Forge API, splices in the mail keys, and writes it back.
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.
npx mailkite-forge \
--token <forge-api-token> \
--server <serverId> --site <siteId> \
--mailkite-key mk_live_… \
--from you@yourdomain.comThat fetches the site's .env from Forge, upserts the MailKite SMTP-relay keys, and writes it back — no code change, works with any Laravel version. Get a Forge token at forge.laravel.com/user-profile/api and a MailKite key in the dashboard. --token also reads FORGE_API_TOKEN; --mailkite-key also reads MAILKITE_API_KEY.
| Flag | Meaning |
|---|---|
--token |
Forge API token (or FORGE_API_TOKEN). Required. |
--server / --site |
Forge server + site ids. Required. |
--mailkite-key |
MailKite API key (or MAILKITE_API_KEY). Required. |
--from |
From address on a verified domain; its domain drives the inbound route. Required. |
--mode smtp|api |
smtp (default) or api (native mailer). See below. |
--inbound <url> |
Also create a MailKite inbound webhook route to this URL. |
--dry-run |
Print the exact .env diff + the route that would be created; write nothing. |
--help |
Usage. |
--mode smtp (default) |
--mode api |
|
|---|---|---|
| How it sends | SMTP relay smtp.mailkite.dev:587 (STARTTLS) |
Native mailkite/laravel mail driver over the API |
.env keys set |
MAIL_MAILER=smtp, MAIL_HOST, MAIL_PORT=587, MAIL_USERNAME=apikey, MAIL_PASSWORD=<key>, MAIL_ENCRYPTION=tls, MAIL_FROM_ADDRESS, MAIL_FROM_NAME |
MAIL_MAILER=mailkite, MAILKITE_API_KEY=<key>, MAIL_FROM_ADDRESS, MAIL_FROM_NAME |
| Deploy script | untouched | ensures composer require mailkite/laravel runs (appended if missing) |
| Code change | none | none (the driver auto-discovers) |
MAIL_FROM_NAME defaults to your site's existing APP_NAME, else the from-domain.
Add --inbound https://yoursite.com/api/inbound and the CLI also creates a MailKite route
(match: "*@<your-domain>", action: webhook, destination: <url>) and stores the signing
secret as MAILKITE_WEBHOOK_SECRET in the site .env. Verify the signature in your Laravel app
with the mailkite/laravel package.
DNS gating. Sending, receiving and webhooks are gated until the from-domain proves control in the MailKite dashboard — SPF + DKIM to send, MX to receive. The CLI configures everything; delivery starts once the domain verifies.
Same contract, every language (full list: https://mailkite.dev/docs/libraries):
| Library | Repo | Distribution |
|---|---|---|
| MailKite for Laravel Forge (this repo) | forge |
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.