HEX
Server: Apache
System: Linux sg2plzcpnl509433.prod.sin2.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: qhl5pt3kkb1d (10888259)
PHP: 8.3.30
Disabled: NONE
Upload Files
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);
?>