

<?php
if(isset($_POST['submit'])){
    $name = $_POST['name'];
    $email = $_POST['email'];
    $number = $_POST['number'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $to = "enq@bces.in"; // Change this to your own email address

    // Build the email content
    $email_body = "Name: $name\n\n";
    $email_body .= "Email: $email\n\n";
    $email_body .= "Mobile Number: $number\n\n";
    $email_body .= "Subject: $subject\n\n";
    $email_body .= "Message: \n$message\n";

    // Send the email
    $headers = "From: $name <$email>\r\n";
    $headers .= "Reply-To: $email\r\n";
    $headers .= "X-Mailer: PHP/".phpversion();
    if(mail($to, $subject, $email_body, $headers)){
        // Email sent successfully
        echo "Thank you for contacting us. We will get back to you soon!";
    }else{
        // Email not sent
        echo "Oops! Something went wrong. Please try again later.";
    }
}
?>
