<?php
require_once __DIR__ . '/../app/helpers/mailer.php';

echo "PHPMailer: " . (class_exists(\PHPMailer\PHPMailer\PHPMailer::class) ? "yes" : "no") . PHP_EOL;
echo "FLEET_SMTP_HOST:" . (getenv('FLEET_SMTP_HOST') ?: '<unset>') . PHP_EOL;
echo "FLEET_SMTP_PORT:" . (getenv('FLEET_SMTP_PORT') ?: '<unset>') . PHP_EOL;
echo "FLEET_SMTP_USER:" . (getenv('FLEET_SMTP_USER') ?: '<unset>') . PHP_EOL;
echo "FLEET_SMTP_SECURE:" . (getenv('FLEET_SMTP_SECURE') ?: '<unset>') . PHP_EOL;

$to = getenv('TEST_MAIL_TO') ?: '';
if ($to) {
    $ok = sendMail($to, 'FleetOps diag test', '<p>Diagnostic email from FleetOps</p>');
    echo 'sendMail returned: ' . ($ok ? 'true' : 'false') . PHP_EOL;
} else {
    echo "TEST_MAIL_TO not set\n";
}
