
Building @mailkube (EU-hosted email API) · Created Jasmin, the open-source SMS gateway · 20+ years architecting messaging infrastructure.
- Tweets262
- Following567
- Followers183
- Likes82

ALT Diagram: a relay in front of your apps. Inside your cluster, an app, a worker and a legacy SMTP-only app send plain SMTP to the smtp-relay container. Inside it, smtpd on port 25 answers 250 in milliseconds and puts the message in a durable spool queue; a client with TLS and AUTH sends it to smtp.mailkube.com on port 587 with STARTTLS over one authenticated, reused connection. A dashed arrow from the client back to the spool reads: 4xx, defer, back off, retry. Footer: ghcr.io/mailkube/smtp-relay, Docker Compose, Kubernetes, OpenShift.

ALT Records Auto Setup writes on Cloudflare for notify.example.com, domain status Onboarding. TXT kube1._domainkey.notify: DKIM public key, mailkube keeps the private half. TXT _dmarc.notify: DMARC at p=none, failures reported, nothing rejected. MX mkube-send.notify: return path, bounces come back here. TXT mkube-send.notify: SPF, checked on the return path. Footer: your apex SPF record is not touched; the authorization adds records and removes none.

ALT Terminal. curl -X POST https://api.mailkube.com/mta/v1/emails with an Authorization: Bearer $MAILKUBE_API_KEY header and a JSON body: from Acme <[email protected]>, to [email protected], subject Welcome to Acme, html Welcome, your account is ready. The response is JSON with id 3f9a7c21-5b6e-4d0a-9c8e-2b7f1e4d6a90 and message_id <[email protected]>.

ALT Two Express webhook handlers, both using express.raw. Before, webhook.js: require EventWebhook and EventWebhookHeader from @sendgrid/eventwebhook, convert SENDGRID_PUBLIC_KEY to ECDSA, call verifySignature with the key, the body and the signature and timestamp headers, answer 403 if it fails, then JSON.parse the body. After, webhook.mjs: import verify and SignatureVerificationError from @mailkube/mailkube-node, await verify(req.body, req.headers, SECRET), answer 400 on a SignatureVerificationError, and on email.bounced call suppress(event.data.bounce.recipient), a typed payload.

ALT Terminal running: mailkube emails send --dry-run --from "Acme <[email protected]>" --to [email protected] --subject "Hello from the CLI" --text "It works." The output is JSON: method POST, url https://api.mailkube.com/mta/v1/emails, a body with the from, to, subject and text fields, and dryRun: true.
