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

use Aws\Ses\SesClient;
use Aws\Exception\AwsException;

$SesClient = new SesClient([
    'version' => 'latest',
    'region'  => 'us-east-1',
    'credentials' => [
        'key'    => 'AKIAWG5UMZF72FF33OM3',
        'secret' => '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',
    ],
]);

$sender = 'support@accounts-books.info';
$recipient = 'vikas.rai@mightywarner.com';

try {
    $result = $SesClient->sendEmail([
        'Destination' => ['ToAddresses' => [$recipient]],
        'Message' => [
            'Body' => [
                'Html' => ['Charset' => 'UTF-8', 'Data' => '<p>Hello from AWS SES API!</p>'],
            ],
            'Subject' => ['Charset' => 'UTF-8', 'Data' => 'SES API Test Email working'],
        ],
        'Source' => $sender,
    ]);
    echo "✅ Email sent! Message ID: " . $result['MessageId'] . "\n";
} catch (AwsException $e) {
    echo "❌ Error: " . $e->getAwsErrorMessage() . "\n";
}
