File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/weddingmitra.in/mail.php
Back
<?php $secretKey = '6LdGwAwrAAAAAPbUN-swhrli6HviJ1bg3_NqpLNK'; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; $remoteIp = $_SERVER['REMOTE_ADDR']; $verifyUrl = "https://www.google.com/recaptcha/api/siteverify"; $response = file_get_contents($verifyUrl . "?secret=" . $secretKey . "&response=" . $captcha . "&remoteip=" . $remoteIp); $responseData = json_decode($response); if (!$responseData->success) { header("Location: " . $_SERVER['HTTP_REFERER'] . "?error=captcha"); exit; } } else { header("Location: " . $_SERVER['HTTP_REFERER'] . "?error=captcha"); exit; } // Get form data $name = htmlspecialchars(trim($_POST['name'])); $email = htmlspecialchars(trim($_POST['email'])); $phone = htmlspecialchars(trim($_POST['phone'])); $subject = htmlspecialchars(trim($_POST['subject'])); $message = htmlspecialchars(trim($_POST['textarea'])); // Email configuration $to = "weddingmitrain@gmail.com"; // 🔁 Replace with your recipient email $email_subject = !empty($subject) ? $subject : "New Contact Form Submission"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: $name <$email>" . "\r\n"; $headers .= "Reply-To: $email" . "\r\n"; // HTML Email Body with Table $email_body = " <html> <head> <style> table { border-collapse: collapse; width: 100%; max-width: 600px; } th, td { text-align: left; padding: 8px; border: 1px solid #ddd; } th { background-color: #f2f2f2; } </style> </head> <body> <h2>New Contact Form Submission</h2> <table> <tr><th>Name</th><td>$name</td></tr> <tr><th>Email</th><td>$email</td></tr> <tr><th>Phone</th><td>$phone</td></tr> <tr><th>Subject</th><td>$subject</td></tr> <tr><th>Message</th><td>" . nl2br($message) . "</td></tr> </table> </body> </html> "; // Send email if (mail($to, $email_subject, $email_body, $headers)) { header("Location: " . $_SERVER['HTTP_REFERER'] . "?success=true"); } else { header("Location: " . $_SERVER['HTTP_REFERER'] . "?error=mail"); } exit; } else { header("Location: " . $_SERVER['HTTP_REFERER'] . "?error=invalid"); exit; } ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings