<?php

$email = $_GET['email'];
$vcode = $_GET['vcode'];

require '../../vendor/autoload.php'; // Correct for Composer setup

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


// (Optional) Save this code to your database or session for verification
// Example: $_SESSION['verification_code'] = $code;

$mail = new PHPMailer(true);

try {
    $mail->isSMTP();
    $mail->Host = 'smtp.hostinger.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'info@Lenexbanking.com';
    $mail->Password = 'Swift..LQ@0623';
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;

    $mail->setFrom('info@Lenexbanking.com', 'Lenexbanking');
    $mail->addAddress($email);
    $mail->isHTML(true);

    $mail->Subject = 'Your Verification Code';
    $mail->Body    = "
        <h2>Verify Your Email</h2>
        <p>Your 6-digit verification code is:</p>
        <div style='font-size: 24px; font-weight: bold; color: #333;'>$vcode</div>
        <p>This code will expire in 10 minutes.</p>
    ";

    $mail->send();
     header('location: ../../verify.php');
} catch (Exception $e) {
    echo "Mailer Error: {$mail->ErrorInfo}";
}
?>


