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

/* Exception class. */
require '\PHPMailer\src\Exception.php';

/* The main PHPMailer class. */
require '\PHPMailer\src\PHPMailer.php';

/* SMTP class, needed if you want to use SMTP. */
require '\PHPMailer\src\SMTP.php';


//require("/PHPMailer-master/src/PHPMailer.php");
//require("/PHPMailer-master/src/SMTP.php");
//require("/PHPMailer-master/src/Exception.php");
$mail = new PHPMailer\src\PHPMailer(true);



$mail = new PHPMailer(true); 
 
try {
    //Server settings
    $mail->SMTPDebug = 2; // Enable verbose debug output
    $mail->isSMTP(); // Set mailer to use SMTP
    $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
    $mail->SMTPAuth = true; // Enable SMTP authentication
    $mail->Username = 'jghomim@gmail.com'; // SMTP username
    $mail->Password = 'borej2002'; // SMTP password
    $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587; // TCP port to connect to
 
    //Recipients
    $mail->setFrom('jghomim@gmail.com', 'Mailer');
    $mail->addAddress('jghomim@gmail.com', 'Joe User'); // Add a recipient
    //$mail->addCC('cc@example.com');   //Uncomment to add CC recipient
    //$mail->addBCC('bcc@example.com'); //Uncomemnt to add BCC recipient
 
    //Attachments
    //$mail->addAttachment('./assets/invoice.pdf');  //Attach file to email
 
    //Content
    $mail->isHTML(true); // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
 
    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>