> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Php

# PHP Quickstart

Send your first email with the Mailofly PHP SDK.

**Requires:** PHP 8.1+ · [API key](api-keys.md) · [Account key](sending-accounts.md)

***

## 1. Install

```bash theme={null}
composer require mailofly/mailofly
```

***

## 2. Send an email

```php theme={null}
<?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']);
```

***

## 3. Check mail logs

```php theme={null}
$client->mailLogs->list(['page' => 1, 'page_size' => 10]);
```

Or open **[Emails](https://www.mailofly.com/user/emails)** in the app.

***

## Next

* [PHP SDK](../sdks/php.md) — full reference
* [Sending examples](sending-examples.md)
* [API: Emails](https://docs.mailofly.com/api/emails)


## Related topics

- [Introduction](/api/index.md)
- [Http](/getting-started/http.md)
- [Phpmailer](/smtp/phpmailer.md)
