File: /home/qhl5pt3kkb1d/public_html/tstp-old/send-email.php
<?php
$url = 'https://api.brevo.com/v3/smtp/email';
$apiKey = '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';
$data = [
"sender" => [
"name" => "The Smart Test Prep",
"email" => "info@tstp.in"
],
"to" => [
[
"email" => "surya2254@gmail.com",
"name" => "Suryakant Vishwakarma"
]
],
"subject" => "Hello world",
"htmlContent" => "<html><head></head><body><p>Hello,</p>This is my first transactional email sent from Brevo.</p></body></html>"
];
$headers = [
'accept: application/json',
'api-key: ' . $apiKey,
'content-type: application/json'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo 'Response:' . $response;
}
curl_close($ch);
?>