PHP

To make the HTTP request easier, we use Guzzle for the example. Be free to use whatever you want

<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();
$url = "https://api.mailwind.io/v1/send/resend";

$data = [
    'layoutIdentifier' => '<<YOUR_LAYOUT_ID>>',
    'variables' => [],
    'code' => null,
    'from' => 'Example <example@mailwind.io>',
    'to' => 'example@mailwind.io',
    'subject' => 'hello world'
];

$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();
}
?>

Last updated