<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $fullname = htmlspecialchars($_POST['fullname']);
    $email    = htmlspecialchars($_POST['email']);
    $subject  = htmlspecialchars($_POST['subject']);
    $message  = htmlspecialchars($_POST['message']);

    $to = "info@ebentgroup.com.ng";
    $email_subject = "Contact Form: " . $subject;

    $email_body = "
    Name: $fullname
    Email: $email

    Message:
    $message
    ";

    $headers = "From: $email";

    if (mail($to, $email_subject, $email_body, $headers)) {
        echo "Message sent successfully!";
    } else {
        echo "Failed to send message.";
    }
}
?>