Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

1

Install the SDK

Add the SDK to your project with Composer:
composer require paubox/paubox-php
2

Set your credentials

Create a .env file in your project root:
PAUBOX_API_KEY=YOUR_API_KEY
PAUBOX_API_USER=YOUR_USERNAME
The SDK loads these values automatically. To obtain credentials, see Authentication.
3

Send your first email

Create a file send.php:
<?php
require_once __DIR__ . '/vendor/autoload.php';

$paubox  = new Paubox\Paubox();
$message = new Paubox\Mail\Message();

$header = new Paubox\Mail\Header();
$header->setSubject("Your first Paubox email");
$header->setFrom("sender@yourdomain.com");

$content = new Paubox\Mail\Content();
$content->setPlainText("This message was sent with the Paubox PHP SDK.");

$message->setHeader($header);
$message->setContent($content);
$message->setRecipients(["recipient@example.com"]);

$response = $paubox->sendMessage($message);

echo "Sent. Tracking ID: " . $response->sourceTrackingId . PHP_EOL;
Run it:
php send.php
Sent. Tracking ID: abc123-def456-...
4

Check delivery status

Use the tracking ID to check delivery:
$disposition = $paubox->getEmailDisposition($response->sourceTrackingId);

foreach ($disposition->data->message->message_deliveries as $delivery) {
    echo $delivery->recipient . " → " . $delivery->status->deliveryStatus . PHP_EOL;
}
recipient@example.com → delivered

Next steps

  • Email client: add HTML, attachments, CC/BCC, and handle errors
  • Forms client: retrieve form schemas and submit responses