<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require_once "PHPMailer/src/PHPMailer.php";
require_once "PHPMailer/src/SMTP.php";
require_once "PHPMailer/src/Exception.php";

$mail = new PHPMailer(true);

//Enable SMTP debugging.
$mail->SMTPDebug = 0; //0 or 2 

//Set PHPMailer to use SMTP.
$mail->isSMTP();

//Set SMTP host name                          
$mail->Host = "smtpout.secureserver.net";

//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 = "dr.sudhirgupta@carencure.co.in";
$mail->Password = "Carencure#121";

//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";

//Set TCP port to connect to
$mail->Port = 587;

$mail->From = "dr.sudhirgupta@carencure.co.in";
$mail->FromName = "Carencure.co.in";

$mail->addAddress("dr.sudhirgupta@carencure.co.in", "Sudhir Gupta");

$mail->isHTML(true);
$mail->Subject = "Contact Us Form details";

$message = "
<table>
Contact Us Form details<br><br>

     Name : ".$_POST["element_0"]."<br>
     Email : ".$_POST["element_1"]."<br>
     Mobile : ".$_POST["element_2"]."<br>
     Message:   ".$_POST["element_3"]."<br>


</table>
";

$mail->Body = $message;

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





























?>