Website URL : http://clonesites.kesug.com/school/index.html
scroll down to form or conact us form .
Error Message
I want to be able to recieve messages that users send to my gmail account that I put in the php code , I don’t want to send them , I don’t want to STMP or PHP mailer , unfortunately I dodn’t find a solution yet.
Other Information
I’m using the free hosting, here is the code :
<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$message = $_POST["message"];
// Recipient email address (your Gmail address)
$to = "I used my gmail [email protected]";
// Email subject
$subject = "Contact Form Submission";
// Email message
$email_message = "Name: $name\nEmail: $email\nPhone: $phone\nMessage:\n$message";
// Additional headers
$headers = "From: $email";
// Send the email
if (mail($to, $subject, $email_message, $headers)) {
echo "Message sent successfully!";
// Redirect the user to a thank you page or back to the contact form
header("Location: thank_you.html");
exit();
} else {
echo "Message could not be sent.";
}
}
?>