Programmable email · Go

Programmable email in Go

Drive email entirely from Go: send with one call, receive every inbound message as parsed JSON on a webhook, and give any app or AI agent its own inbox on a domain you control — with no mail server to run.

Start free Quickstart

Install

Add the Go library:

install · Go
go get github.com/mailkite/mailkite-go

Send an email

One endpoint, one API key — over your own authenticated domain. Send API reference →

send · Go
mk := mailkite.New(os.Getenv("MAILKITE_API_KEY"))

res, err := mk.Send(mailkite.Message{
From: "hello@myapp.ai",
To: "ada@example.com",
Subject: "Your invoice #1042",
HTML: "<p>Thanks! Receipt attached.</p>",
})

Receive email as a webhook

Point your domain's MX at MailKite and every message arrives as parsed JSON — verify the signature, then handle it. No IMAP, no mail server.

receive · Go
http.HandleFunc("/hooks/mailkite", func(w http.ResponseWriter, r *http.Request) {
rawBody, _ := io.ReadAll(r.Body)
sig := r.Header.Get("x-mailkite-signature")
if !mailkite.VerifyWebhook(sig, string(rawBody), secret) {
w.WriteHeader(http.StatusUnauthorized)
return
}
var event map[string]any
json.Unmarshal(rawBody, &event)
// ...handle event["type"] == "email.received"
w.Header().Set("content-type", "application/json")
w.Write([]byte(mailkite.ReplyOk())) // {"status":"ok"}
})

Go deeper: Email to webhook: the complete guide, or give an AI agent its own inbox.

Everything programmable email does

Send, receive, and agent inboxes — the same shape in every language. See the full picture →

Unlimited domains ·Unlimited mailboxes ·3,000 emails/mo — 100 emails/day. Pricing →