Search by

Sendtern transactional email SDK for PHP and Laravel

Package info

github.com/Sendtern/sendtern-sdks

Homepage

Language:Rust

pkg:composer/sendtern/sdk

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.0 2026-12-01 17:04 UTC

This package is auto-updated.

Last update: 2026-12-03 21:48:32 UTC


README

Use Sendtern from Node.js and TypeScript, Python, Ruby, PHP, Laravel, Go, Rust, Java, or .NET. Every SDK can send email, submit batches, list messages, look up delivery by ID, and capture test email in Email Playground.

SDK guide · API reference · Release v0.3.0

Install

SDK Requirements Distribution Installation and examples
Node.js and TypeScript Node.js 18+ GitHub release Node.js
Python Python 3.9+ GitHub release Python
Ruby Ruby 3.1+ GitHub release Ruby
PHP PHP 8.1+, cURL and Composer Packagist PHP
Laravel Laravel 12+ Packagist Laravel
Go Go 1.21+ pkg.go.dev Go
Rust Rust 1.88+ GitHub source Rust
Java Java 17+ GitHub release Java
.NET .NET 8+ GitHub release .NET

For PHP and Laravel, run composer require sendtern/sdk. For Go, run go get github.com/Sendtern/sendtern-sdks/go@v0.3.1. The GitHub release includes the downloadable artifacts and SHA-256 checksums.

Make your first API call

Create a sending-only API key and set SENDTERN_API_KEY in your server environment. Start in Email Playground, where you can inspect the captured message without delivering it.

npm install https://github.com/Sendtern/sendtern-sdks/releases/download/v0.3.0/sendtern-sdk-0.3.0.tgz

Save this as sendtern-example.mjs and run node sendtern-example.mjs.

import { Sendtern } from '@sendtern/sdk';

const sendtern = new Sendtern(process.env.SENDTERN_API_KEY);
const { id } = await sendtern.emails.capture({
  from: 'sandbox@sendtern.test',
  to: 'you@example.com',
  subject: 'Sendtern integration check',
  text: 'This message was captured by Sendtern.',
});
console.log(id);

The ID appears in Email Playground. When you are ready to send a live message, verify your sending domain, use a sender address on that domain, and call the SDK send method.

API behavior

Operation HTTP endpoint Result
Send POST /emails ID of the accepted email
Send batch POST /emails/batch IDs of the accepted emails and, in permissive mode, errors with their original indexes
Look up GET /emails/{id} Delivery state in last_event and an events timeline
List GET /emails Searchable email summaries with after pagination
Capture POST /test/emails ID in Email Playground
  • Keys. A sending-only key can send and capture. Listing email and reading delivery details require a full-access key for the client project. Keep both keys on the server and out of source control.
  • Delivery. A successful send means Sendtern accepted the request for processing. Use last_event or the email timeline in the dashboard to follow delivery.
  • Batches. The default strict mode rejects the entire batch if validation fails. Permissive mode can accept valid rows and returns indexed errors for rejected rows. An entirely invalid batch returns an API error.
  • Retries. Reuse the same idempotency key, payload, and batch mode when retrying an operation. The send and batch endpoints retain replay results for 24 hours. Honor Retry-After when provided.
  • Base URL. Clients default to https://sendtern.com. For a self-hosted instance, configure its native API base URL through the client constructor.

Use other client endpoints

Use the JSON method for routes in the client OpenAPI specification. Pass a path such as /domains or /emails?limit=20. Encode each user-supplied path segment or query value before building the path. An HTTP 204 response returns the language's null value or no result in Go.

SDK List emails JSON request Binary download
Node.js / TypeScript client.emails.list({ limit: 20 }) client.request('GET', '/domains') client.download(path)
Python client.emails.list(limit=20) GitHub release client.request('GET', '/domains')
Ruby client.emails.list(limit: 20) GitHub release client.request('GET', '/domains')
PHP / Laravel $client->list(limit: 20) $client->request('GET', '/domains') $client->download($path)
Go client.List(ctx, sendtern.ListOptions{Limit: 20}) pkg.go.dev client.Request(ctx, http.MethodGet, "/domains", nil, "", &result)
Rust client.list(&ListOptions { limit: Some(20), ..Default::default() }) GitHub source client.request(ApiMethod::Get, "/domains", None, None)
Java client.list(20, null, null, null) GitHub release client.request("GET", "/domains", null, null)
.NET client.ListAsync(limit: 20) GitHub release client.RequestAsync(HttpMethod.Get, "/domains")

When has_more is true, pass the last message ID as after and keep the same filters. The download methods return the original bytes of binary endpoints listed in your deployment's OpenAPI specification. Check that specification for route availability and required key permissions.

Verify a release

Use the checksum file attached to the release to verify the downloads.

sha256sum -c SHA256SUMS

To build the release locally, install the toolchains listed above plus uv and Maven. Run the build script from the repository root.

bash test/build.sh ./artifacts

The installation smoke tests exercise all nine integrations against an isolated Sendtern sandbox. Set SENDTERN_BASE_URL and a full-access SENDTERN_API_KEY for that sandbox.

bash test/run.sh
# To test packages built locally
bash test/run.sh /path/to/artifacts

The SDKs are available under the MIT License.