Install the SDK
composer require groundmail/groundmailConfigure your API key
export GROUNDMAIL_API_KEY=gm_your_key_hereSend an email
<?php
use Groundmail\Client;
$tx = new Client(getenv('GROUNDMAIL_API_KEY'));
$result = $tx->emails->send([
'from' => 'ops@yourdomain.com',
'to' => 'user@example.com',
'subject' => 'Your receipt',
'html' => '<p>Thanks for your purchase.</p>',
]);
echo $result['id'], ' ', $result['status'], PHP_EOL;Resources
The client includes thin wrappers for common API resources:
$tx->emails— send, batch, list, cancel, resend, test webhooks, deliverability insights$tx->domains— create, verify, apply DNS, update, delete$tx->webhooks— CRUD for webhook endpoints$tx->templates— CRUD plus publish$tx->suppressions— list, create, remove$tx->validate($email)and$tx->validateBatch($emails)— check addresses before you accept them (validation);mailboxCheck: truealso confirms the mailbox exists
See the API reference for request fields. The PHP SDK accepts the same JSON shapes as the REST API.
For Symfony Mailer, use groundmail/symfony-mailer. For Laravel, use groundmail/laravel (config, container binding, Facade — built on the Symfony transport).
Source
Package source lives in Groundmail/groundmail-php (Packagist requires composer.json at repo root).