File: /var/www/ethnikamauricia.com/wp-content/plugins/dzhwa/test.php
<?php
// Auto detect server domain
$domain = $_SERVER['SERVER_NAME'];
$from = "test@" . $domain;
// Auto subject & message
$subject = "Server Email Test from " . $domain;
$message = "Hello,\n\nThis is an automatic test email from server: " . $domain . "\n\nIf you received this message, your server can send emails correctly.\n\nDate: " . date("Y-m-d H:i:s");
// When form submitted
$status = "";
if (isset($_POST['send'])) {
$to = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
$status = "<div style='color:red'>❌ Invalid email address</div>";
} else {
$headers = "From: $from\r\n" .
"Reply-To: $from\r\n" .
"X-Mailer: PHP/" . phpversion();
if (mail($to, $subject, $message, $headers)) {
$status = "<div style='color:green'>
✅ Email SENT successfully to: <b>$to</b><br>
From: $from
</div>";
} else {
$status = "<div style='color:red'>
❌ Sending FAILED<br>
Server: $domain<br>
From: $from
</div>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Mail Test</title>
<style>
body{font-family:arial;background:#f5f5f5;padding:30px}
.box{max-width:400px;margin:auto;background:#fff;padding:20px;border-radius:8px}
input{width:100%;padding:10px;margin:10px 0}
button{padding:10px 20px}
</style>
</head>
<body>
<div class="box">
<h3>📧 PHP Email Test</h3>
<?php echo $status; ?>
<form method="post">
<input type="email" name="email" placeholder="Enter your email" required>
<button name="send">Send Test Mail</button>
</form>
<p style="font-size:12px;color:#666">
Server detected: <b><?php echo $domain; ?></b><br>
t.me/pyall
</p>
</div>
</body>
</html>