1. Go to this page and download the library: Download misarai/misarmail-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
misarai / misarmail-php example snippets
use MisarMail\Client;
$mail = new Client(getenv('MISARMAIL_API_KEY'));
$overall = $mail->analytics->overview(['startDate' => '2026-04-01', 'endDate' => '2026-04-30']);
$one = $mail->analytics->overview(['campaignId' => $campaignId]);
$keys = $mail->keys->list();
count($keys['keys']);
$fresh = $mail->keys->create(['name' => 'CI', 'scopes' => ['send', 'read']]);
echo $fresh['key']; // shown once and never again
try {
$mail->campaigns->create([
'name' => 'Blast',
'subject' => 'We just shipped',
'fromName' => 'Your Name',
'fromEmail' => '[email protected]',
]);
} catch (MisarMail\PlanLimitError $e) {
fwrite(STDERR, "{$e->feature} exhausted on {$e->plan}: {$e->upgradeUrl}\n");
// $e->retryAfter is seconds until the allowance resets, when the API says so
}