github.com/Sendflit/sendflit-go. It uses only the standard library, so it has no third-party dependencies. The package name is sendflit. It requires Go 1.21 or later.
Looking for another language? See the SDK overview.
Install
Create a client
New returns a client with a 15 second timeout and 2 retries. To point the client at a test server, use NewWithBaseURL(apiKey, baseURL). You can also change the HTTP and MaxRetries fields on the returned *Client.
Every method takes a context.Context first. Use it to cancel a call or to set a deadline:
Send an email
Send takes an Email struct and returns a *SendResult.
Email:
SendResult has ID, Status, and To.
Attachments
UseAttach for text content and AttachBytes for binary content. Both base64-encode the data for you.
- Up to 10 attachments per message.
- Up to 10 MB per attachment. Larger files are rejected with
422.
Send a batch
Batch sends up to 100 emails in one request and returns a []SendResult in the same order as your input.
List emails
GET /v1/emails/{id} or DELETE /v1/emails/{id} directly if you need them. See the API reference.
Domains
VerifyDomain returns only an error. A nil error means the call succeeded. Check the domain’s state in the dashboard or with the API if you need the details. For DNS setup, see Domains.
Suppressions
Health
Health calls GET /health. It doesn’t need a valid key.
Verify webhooks
VerifyWebhookSignature returns true or false. It compares signatures in constant time. See Webhooks for the event list.
Errors and retries
Failed API calls return an*APIError:
Network failures return a regular error with no status.
429 or 5xx are retried up to MaxRetries times. The SDK waits for the Retry-After header when present, and otherwise backs off exponentially. Other 4xx responses are not retried. See Errors, retries and limits.
Method reference
Next steps
- Quickstart: send your first email from the command line.
- Batch sending: limits and per-item results.
- Webhooks: events and payloads.