<?php
$payload = [
'version' => '1.0',
'email' => [
'from' => 'orders@yourdomain.com',
'fromName' => 'Acme Store',
'subject' => 'Your order is confirmed',
'html' => '<html><body><p>Thanks for your order!</p></body></html>',
'text' => 'Thanks for your order!',
'recipients' => [
'to' => [['name' => 'Jane', 'email' => 'jane@example.com']],
],
],
];
$ch = curl_init('https://email-api.mailercloud.com/email');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;