<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

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

// FIXED PATH (your project structure)
require __DIR__ . '/../classes/PHPMailer/src/Exception.php';
require __DIR__ . '/../classes/PHPMailer/src/PHPMailer.php';
require __DIR__ . '/../classes/PHPMailer/src/SMTP.php';

$mail = new PHPMailer(true);

try {
    $mail->isSMTP();
    $mail->SMTPDebug = 2;

    $mail->Host = "smtp.gmail.com";
    $mail->SMTPAuth = true;
    $mail->Username = "s26118152@gmail.com";
    $mail->Password = "gyiv ebml hzoc otmh";
    $mail->SMTPSecure = "tls";
    $mail->Port = 587;

    $mail->setFrom("s26118152@gmail.com", "SMTP TEST");
    $mail->addAddress("s26118152@gmail.com");

    $mail->isHTML(true);
    $mail->Subject = "Gmail SMTP Test Working!";
    $mail->Body = "If you received this, Gmail SMTP is working.";

    echo "<pre>Sending email...\n\n";
    $mail->send();
    echo "SUCCESS! Email sent.</pre>";

} catch (Exception $e) {
    echo "<pre>";
    echo "SMTP ERROR:\n\n";
    echo $mail->ErrorInfo;
    echo "</pre>";
}