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();

$data = [
    'accessKey' => '<<YOUR_ACCESS_KEY>>',
    'secretKey' => '<<YOUR_SECRET_KEY>>',
    'region' => '<<YOUR_AWS_REGION>>', // eg. us-east-1
    'layoutIdentifier' => '<<YOUR_LAYOUT_ID>>',
    'variables' => new stdClass(), // Empty object
    'source' => 'example@mailwind.io',
    'destination' => [
        'toAddresses' => ['example@mailwind.io']
    ],
    'message' => [
        'subject' => [
            'data' => '[Your Subject Here]'
        ]
    ]
];

try {
    $response = $client->post('https://api.mailwind.io/v1/send/ses', [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'json' => $data
    ]);

    // To get the response body as a string
    $responseBody = $response->getBody()->getContents();
    echo $responseBody;

} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
?>

Last updated