<?php
include 'includes/send_email.php';

// Test email configuration
echo "<h2>Testing Email Configuration</h2>";
echo "<hr>";

// Send test email to yourself
$testEmail = "your-personal-email@gmail.com"; // Apni personal email daalein
$result = testEmailConfiguration($testEmail);

if($result['success']) {
    echo "<p style='color: green;'>✅ Test email sent successfully to: " . $testEmail . "</p>";
    echo "<p>Please check your inbox.</p>";
} else {
    echo "<p style='color: red;'>❌ Failed to send test email: " . $result['message'] . "</p>";
    echo "<h3>Troubleshooting Steps:</h3>";
    echo "<ul>";
    echo "<li>Make sure PHPMailer is installed correctly</li>";
    echo "<li>Check your internet connection</li>";
    echo "<li>Verify email credentials: noreply@bmyouth.org / @Anupsinha@321</li>";
    echo "<li>For Gmail, you might need to enable 'Less secure app access' or use 'App Password'</li>";
    echo "</ul>";
}

// Also check if PHPMailer files exist
echo "<h3>PHPMailer Status:</h3>";
$phpmailer_files = [
    __DIR__ . '/includes/PHPMailer/Exception.php',
    __DIR__ . '/includes/PHPMailer/PHPMailer.php',
    __DIR__ . '/includes/PHPMailer/SMTP.php'
];

foreach($phpmailer_files as $file) {
    if(file_exists($file)) {
        echo "<p style='color: green;'>✅ " . basename($file) . " - Found</p>";
    } else {
        echo "<p style='color: red;'>❌ " . basename($file) . " - Missing</p>";
    }
}
?>