<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require_once "vendor/autoload.php";
require "vendor/PHPMailer/src/PHPMailer.php";
    require "vendor/PHPMailer/src/OAuth.php";
    require "vendor/PHPMailer/src/SMTP.php";
    require "vendor/PHPMailer/src/POP3.php";
    require "vendor/PHPMailer/src/Exception.php";
    require_once __DIR__ . '/catchexception.php';

    //Create a new PHPMailer instance

    //$mail = new PHPMailer();
//$mail = new PHPMailer;
$mail = new PHPMailer();

// $mail->From = "suriyasri8@gmail.com";
// $mail->FromName = "Full Name";

// $mail->addAddress("shrijjs@gmail.com", "Recipient Name");

// //Provide file path and name of the attachments
// //$mail->addAttachment("file.txt", "File.txt");        
// //$mail->addAttachment("images/profile.png"); //Filename is optional

// $mail->isHTML(true);

// $mail->Subject = "Subject Text";
// $mail->Body = "<i>Mail body in HTML</i>";
// $mail->AltBody = "This is the plain text version of the email content";

// try {
//     $mail->send();
//     echo "Message has been sent successfully";
// } catch (Exception $e) {
//     echo "Mailer Error: " . $mail->ErrorInfo;
// }



$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->SMTPDebug  = 1;  
$mail->SMTPAuth   = TRUE;
$mail->SMTPSecure = "tls";
$mail->protocol = "mail";
$mail->Port       = 587;
$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);
$mail->Host       = "smtp.gmail.com";
$mail->Username   = "shrijjs@gmail.com";
$mail->Password   = "Mala#1989";
$mail->IsHTML(true);
$mail->AddAddress("suriyasri8@gmail.com");
$mail->SetFrom("shrijjs@gmail.com", "Daydoc");
$mail->AddReplyTo("shrijjs@gmail.com", "reply-to-name");
//$mail->AddCC("cc-recipient-email@domain", "cc-recipient-name");
$mail->Subject = "Sign up request submitted";
// $content = "<b>We are so glad you registered on daydoc.<br></b>Your account will be activated soon.Here is your subscription link : https://bit.ly/3m3I4Uy";
//$content .= "<br><b>Daydoc Team </b><br>* Payment processor fee (1.75%) applies for each consultation and will be deducted from consultation fee credited to your account";

$mail->MsgHTML("test mail"); 

if(!$mail->Send()) {
  echo "Error while sending Email.";
  var_dump($mail);
} else {
  echo "Email sent successfully";
}
