Documentation

SDKs / Go modules

Go email API SDK

Context-aware, zero-dependency SDK for Go 1.22+. Go 1.22 or newer. No third-party dependencies.

Install

go get github.com/VooStack/mailstack-go

Go modules package ↗ Source on GitHub ↗

Quickstart

Send your first email — create an API key in the dashboard, then:

package main

import (
    "context"
    "fmt"
    "log"

    mailstack "github.com/VooStack/mailstack-go"
)

func main() {
    client := mailstack.New("ms_live_xxxxxxxxxxxx")

    res, err := client.Emails.Send(context.Background(), mailstack.SendEmailRequest{
        From:    "hello@yourdomain.com",
        To:      "user@example.com",
        Subject: "Welcome to MailStack",
        HTML:    "<h1>Hi there 👋</h1>",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(res.ID, res.Status)
}

The send API is authenticated with your ms_live_ key. For dashboard resources (domains, templates, webhooks) pass your organization id too — see the REST API reference.

Verifying webhooks

Verify incoming webhook deliveries against the raw request body. The signature is an HMAC-SHA256 over {timestamp}.{body} carried in the MailStack-Signature header:

ok := mailstack.VerifyWebhookSignature(
    secret,
    string(rawBody), // RAW request body
    r.Header.Get(mailstack.WebhookSignatureHeader),
    5*time.Minute,
)

What's included

  • Every call takes a context.Context
  • Functional options: WithOrgID, WithHTTPClient, WithBaseURL
  • Typed integer enums with String()
  • Webhook signature verification helper
  • Zero third-party dependencies

Next steps

Browse the full REST API reference, read the quickstart, or compare the other official SDKs.