PHP Quickstart
Send your first email with the Mailofly PHP SDK. Requires: PHP 8.1+ · API key · Account key1. Install
2. Send an email
3. Check mail logs
Next
- PHP SDK — full reference
- Sending examples
- API: Emails
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
composer require mailofly/mailofly
<?php
require 'vendor/autoload.php';
use Mailofly\Client;
$client = new Client(getenv('MAILOFLY_API_KEY'));
$result = $client->emails->send([
'from' => 'Acme <onboarding@example.com>',
'to' => ['you@example.com'],
'subject' => 'Hello from Mailofly',
'html' => '<p>It works!</p>',
]);
print_r($result['id']);
$client->mailLogs->list(['page' => 1, 'page_size' => 10]);