<?php
function verif_email($kode, $email){
    $url = "https://api.smtp2go.com/v3/email/send";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$data = <<<DATA
{
    "api_key": "api-E669B2D8260E11EE8FD5F23C91C88F4E",
    "to": ["$email"],
    "sender": "user@2freemail.my.id",
    "subject": "Borneo Media SMM - Verification",
    "text_body": "Kode Verifikasi Anda adalah: $kode"
}
DATA;

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);
$hasil1 = json_decode($resp, true)["data"]["succeeded"];
return $hasil1;
}

var_dump(verif_email("93240234", "akunline1@hi2.in"));