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

echo "<h1>Email Test</h1>";

// Test 1: Check if mail function exists
if (function_exists('mail')) {
    echo "✅ PHP mail() function exists<br>";
} else {
    echo "❌ PHP mail() function does NOT exist<br>";
}

// Test 2: Send a test email
$to = "rxaero.mro@gmail.com";
$subject = "Test Email from Your Server";
$message = "This is a test email. If you received this, your mail function works!";
$headers = "From: test@" . $_SERVER['HTTP_HOST'] . "\r\n";
$headers .= "Reply-To: rxaero.mro@gmail.com\r\n";

if(mail($to, $subject, $message, $headers)) {
    echo "✅ Test email sent to " . $to . "<br>";
    echo "Check your inbox/spam folder<br>";
} else {
    echo "❌ Test email FAILED<br>";
}

// Test 3: Show server mail configuration
echo "<br><strong>Server Mail Configuration:</strong><br>";
echo "SMTP: " . ini_get('SMTP') . "<br>";
echo "smtp_port: " . ini_get('smtp_port') . "<br>";
echo "sendmail_from: " . ini_get('sendmail_from') . "<br>";
echo "Host: " . $_SERVER['HTTP_HOST'] . "<br>";
?>