New: the MailCraft MCP server is live — connect your AI agent in one line. Connect your agent →
SDKs

PHP

Send email from any PHP 8.2+ application with the official MailCraft SDK.

Install

terminal
composer require mail-craft/mailcraft-php

Send email

Send from a verified sender on one of your domains.

index.php
use MailCraft\MailCraft;

$mailcraft = new MailCraft(getenv('MAILCRAFT_API_KEY'));

$mailcraft->emails->send(
    from: '[email protected]',
    to: ['[email protected]'],
    subject: 'Welcome!',
    html: '<p>Thanks for signing up.</p>',
);

Keep your API key in the MAILCRAFT_API_KEY environment variable, never in source control. Create one under Settings → API keys, scoped to just what this app needs.

Next steps