"Callback Form", "Service" => $service, "Name" => $name, "Phone" => $phone, "Device" => $device, "IP Address" => $ipAddress, "Location" => $location, ]; // Build HTML email content $htmlBody = "
"; $to = "imagingworld9@gmail.com"; $subject = "New Inquiry Received | Imaging World"; $from = "noreply@imagingworld.in"; $separator = md5(time()); $eol = "\r\n"; $headers = "From: Imaging World <{$from}>" . $eol; $headers .= "Reply-To: sahil@clientsnow.co.in" . $eol; $headers .= "Bcc: leads@clientsnow.co.in" . $eol; $headers .= "MIME-Version: 1.0" . $eol; $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol . $eol; $body = "--" . $separator . $eol; $body .= "Content-Type: text/html; charset=\"UTF-8\"" . $eol; $body .= "Content-Transfer-Encoding: 7bit" . $eol . $eol; $body .= $htmlBody . $eol . $eol; $body .= "--" . $separator . "--" . $eol; // ---------- reCAPTCHA ---------- $recaptcha_secret = '6Lck9v0pAAAAAOIpslVwP-yLjORR0r0N_tQMTZ5D'; $recaptcha_response = $_POST['google-recaptcha-response'] ?? ''; $verifyUrl = 'https://www.google.com/recaptcha/api/siteverify'; $verifyCtx = stream_context_create([ 'http' => [ 'method' => 'POST', 'content' => http_build_query(['secret' => $recaptcha_secret, 'response' => $recaptcha_response]) ] ]); $verifyRes = file_get_contents($verifyUrl, false, $verifyCtx); $result = json_decode($verifyRes); // === SEND TO GOOGLE SHEET === $webhook_url = "https://script.google.com/macros/s/AKfycbxr4mE-xftZscDgslutrQUNBFQhh-Qi5-Ni6QGNV6wDrHnzHpjEtq0CdGHEngbA8JVo/exec"; $options = [ "http" => [ "header" => "Content-type: application/json", "method" => "POST", "content" => json_encode($formdata) ] ]; @file_get_contents($webhook_url, false, stream_context_create($options)); if (mail($to, $subject, $body, $headers)) { header("Location: thankyou"); exit; } else { header("Location: contact-us"); exit; } }