File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/mmgrandvaranasi.com/mail.php
Back
<?php // reCAPTCHA secret key from Google admin panel $secretKey = "6LdivHIrAAAAAISSnwKPiR5fEY7dwD8OpHHlkVT9"; // Verify CAPTCHA if (isset($_POST['g-recaptcha-response'])) { $recaptcha = $_POST['g-recaptcha-response']; $response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $recaptcha ); $responseKeys = json_decode($response, true); if (!$responseKeys["success"]) { echo "CAPTCHA verification failed. Please try again."; exit; } } else { echo "Please complete the CAPTCHA."; exit; } // Sanitize input function clean($value) { return htmlspecialchars(trim($value)); } $name = clean($_POST["name"]); $email = clean($_POST["email"]); $phone = clean($_POST["phone"]); $subject = clean($_POST["subject"]); $message = clean($_POST["message"]); // Email content $EmailTo = "mmgrandvaranasi@gmail.com"; // Replace with your email $Subject = "Enquiry from MM Grand: " . $subject; $Fields = "<table border='1' cellspacing='0' cellpadding='8' style='border-collapse: collapse;'>"; $Fields .= "<tr><td><strong>Name</strong></td><td>{$name}</td></tr>"; $Fields .= "<tr><td><strong>Email</strong></td><td>{$email}</td></tr>"; $Fields .= "<tr><td><strong>Phone</strong></td><td>{$phone}</td></tr>"; $Fields .= "<tr><td><strong>Subject</strong></td><td>{$subject}</td></tr>"; $Fields .= "<tr><td><strong>Message</strong></td><td>{$message}</td></tr>"; $Fields .= "</table>"; // Headers $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=UTF-8\r\n"; $headers .= "From: {$email}\r\n"; // Send email $success = mail($EmailTo, $Subject, $Fields, $headers); // Redirect or show message if ($success) { header("Location: thank-you.php"); exit; } else { echo "Something went wrong. Please try again."; } ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings