Go SDK
The jetemail-go module is the official Go SDK for JetEmail transactional email (MIT license, Go 1.21+, no third-party dependencies). Create a transactional API key in the dashboard: Outbound → Keys → Add API key. Use that key with the SDK.Installation
github.com/jetemail/jetemail-go. Source on GitHub: jetemail/jetemail-go.
Quick start
From address on a verified domain (see Getting started).
Creating a client
*jetemail.Client. Its ApiKey, BaseURL and HTTPClient fields are exported, so they can be changed after creation. The client exposes two services:
Every
Send method has a SendWithContext(ctx, ...) variant that takes a context.Context; Send uses context.Background().
client.Emails.Send(*SendEmailRequest)
Send a single email. Returns (*SendEmailResponse, error).
From, To, Subject and Html/Text locally and returns an error before making a request if any are missing.
Response shape: SendEmailResponse{ Id string, Response string }.
client.Batch.Send([]*SendEmailRequest)
Send up to 100 emails in one request. Each element uses the same fields as a single send. Returns (*BatchSendResponse, error) with Summary (Total, Successful, Failed) and Results per message (each with Status, plus Id and Response on success or Error on failure).
Send returns a *jetemail.BatchValidationError (Index int, Err error) identifying which email is invalid, and nothing is sent.
Attachments
jetemail.Attachment has two fields: Filename and Data, where Data is the base64-encoded file content.
Error handling
API errors (HTTP 4xx/5xx) are returned as*jetemail.APIError with StatusCode int, Message string and the raw Response []byte. Local validation failures and network/transport problems are returned as ordinary error values.
Webhook signature verification
The SDK includes a helper for verifying webhook signatures. It checks the HMAC-SHA256 signature of the raw body and rejects events whose timestamp is outside the tolerance window (defaultjetemail.DefaultWebhookTolerance, 300 seconds).
jetemail.VerifyWebhookWithTolerance(params, 10*time.Minute).
The helper compares the
Signature value directly against the hex HMAC digest. If the header value you receive carries a sha256= prefix (see webhook security), strip it first, e.g. strings.TrimPrefix(r.Header.Get("X-Webhook-Signature"), "sha256=").jetemail.WebhookEvent (Type string, Timestamp int64, Data map[string]interface{}) for decoding the event payload, and constants for each event type (EventOutboundQueued, EventOutboundDelivered, EventOutboundBounced, EventOutboundRejected, EventOutboundDeferred, EventOutboundSpam, EventOutboundDropped, EventOutboundVirus, EventOutboundOpened, EventOutboundClicked, EventOutboundComplaint).
For additional examples, see the README on GitHub. REST details: API reference.