<?php

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

require_once __DIR__ . '/vendor/autoload.php';

$mail = new PHPMailer(true);

try {
    // Configure PHPMailer
    $mail->isSMTP();
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';
    $mail->Port = 587;

    // Configure Gmail SMTP Server
    $mail->Host = 'smtp.gmail.com';
    $mail->Username = 'recent:sofempire@gmail.com';
    $mail->Password = '885493045560200';

    // Configure Email
    $mail->setFrom('sofempire@gmail.com', 'Name');
    $mail->addAddress('sysfer@hotmail.com');
    $mail->Subject = 'PHPMailer Gmail';
    $mail->isHTML(true);
    $mail->Body = 'This is the HTML message body <strong>in bold!</strong>';

    // send mail
    $mail->Send();
    echo 'Message has been sent using Gmail SMTP Server';
} catch (Exception $e) {
    echo 'Mailer Error: ' . $mail->ErrorInfo;
}
