Skip to main content

PHP SDK

The jetemail/jetemail-php package is the official PHP SDK for JetEmail transactional email (MIT license, PHP 8.1+, Guzzle 7.5+). Create a transactional API key in the dashboard: Outbound → Keys → Add API key. Use that key with the SDK.
For Laravel projects, use the dedicated Laravel SDK which includes Mail driver integration and webhook support.

Installation

Package on Packagist: jetemail/jetemail-php. Source on GitHub: jetemail/jetemail-php.

Quick start

Use a from address on a verified domain (see Getting started).
JetEmail is a global (un-namespaced) class registered by Composer’s autoloader, so no use statement is needed. Inside a namespaced file, call it as \JetEmail::client(...).

Creating a client

JetEmail::client() returns a JetEmail\Client exposing two services:

$jetemail->emails->send(array $parameters)

Send a single email. Parameters are a plain associative array using the same field names as the REST API.
The array is sent to the API as-is, so any other field the POST /email endpoint accepts can be included too.

Responses

Every call returns a JetEmail\Resource. Read fields as properties or array keys, or call toArray() for the raw payload:
Response shape for a single send: ['id' => string, 'response' => string].

$jetemail->batch->send(array $emails)

Send up to 100 emails in one request. Each element uses the same fields as a single send. Returns summary (total, successful, failed) and results per message (success with id, or error with error).

Error handling

API errors throw ErrorException; network and transport failures throw TransporterException. A response that is not valid JSON throws UnserializableResponse.
Common status codes: 400 invalid request, 401 bad/missing API key, 500 server error.

Webhook signature verification

The SDK includes a helper for verifying webhook signatures. It checks the HMAC-SHA256 signature and rejects events whose timestamp is older than the tolerance (default 300 seconds).

For additional examples, see the README on GitHub. REST details: API reference.