<?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require './PHPMailer/src/Exception.php';
require './PHPMailer/src/PHPMailer.php';
require './PHPMailer/src/SMTP.php';

$mail = new PHPMailer(true);
try {
//Enable SMTP debugging.
$mail->SMTPDebug = 2;
//Set PHPMailer to use SMTP.
$mail->isSMTP();
$mail->MAIL_DRIVER="smtp";
//Set SMTP host name                          
$mail->Host =gethostbyname('smtp.gmail.com');
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);
//Provide username and password     
$mail->Username = "khnkrwn13@gmail.com";
$mail->Password = "speed210";
//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 587;
$mail->From = "khnkrwn13@gmail.com";
$mail->FromName = "Disccindia";
$mail->addAddress("kap.qatar@gmail.com");
$mail->isHTML(true);
$mail->Subject = "Test Email from Disccindia";
$mail->Body = "This is <i>Mail body in HTML</i>";
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message has been sent";
}
} catch (Exception $e) {
  echo 'Message could not be sent. Mailer Error: '. $mail->ErrorInfo;
}