<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$url = "https://api.mailwind.io/v1/send/sendgrid/v3";
$data = [
'layoutIdentifier' => '<<YOUR_LAYOUT_ID>>',
'variables' => [],
'code' => null,
'personalizations' => [
[
'to' => [
[
'email' => 'example@mailwind.io'
]
],
'subject' => 'Hello from SendGrid!'
]
],
'from' => [
'email' => 'example@mailwind.io'
],
'content' => [
[
'type' => 'text/plain',
'value' => 'This is a test email sent via SendGrid.'
]
]
];
$headers = [
"Content-Type" => "application/json",
"Authorization" => "Bearer <<YOUR_API_KEY_HERE>>"
];
try {
$response = $client->post($url, [
'headers' => $headers,
'json' => $data
]);
$responseBody = $response->getBody();
$decodedResponse = json_decode($responseBody, true);
print_r($decodedResponse);
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
?>