Skip to main content

Go SDK

The simpleemailapi-go package provides a fully typed, high-performance SDK for Go applications with real-time event streaming.
Language: Go 1.21+
Transport: HTTP/2 via Connect RPC

Installation

Usage

Initialize the client with your API key and use the client.Send method.
The From address must belong to a domain you have verified.

Client Configuration

The NewClient function accepts optional configuration:
string
required
Your API Key, starting with sea_live_.
ClientOption
Sets a custom API endpoint. Defaults to https://api.simpleemailapi.dev.
ClientOption
Uses a custom http.Client for requests.

SendEmailRequest Fields

string
required
Sender email address. Must be from a verified domain.
[]string
required
List of primary recipient email addresses.
string
required
Email subject line.
string
Plain text content of the email.
string
HTML content of the email.
[]string
List of CC recipient email addresses.
[]string
List of BCC recipient email addresses.
[]*Attachment
List of files to attach.
string
Reply to a previous email using its Id from our response. We automatically resolve threading headers.
string
Raw Message-ID for threading (advanced). Use ReplyTo for simpler threading with our email IDs.
[]string
List of message IDs for threading context (advanced).
map[string]string
Custom key-value metadata returned in webhooks.
All emails are queued for reliable delivery with automatic retries. Use webhooks or event streaming to track delivery status.

Real-time Event Streaming

Stream email events with typed callbacks using OnReceive:
The stream runs in a background goroutine and automatically reconnects with exponential backoff.

Available Event Handlers

Error Handling

The SDK provides structured error handling with typed error codes:

Error Categories

Advanced Usage

Access underlying service clients for domain management: