| Server IP : 65.1.209.187 / Your IP : 216.73.216.144 Web Server : nginx/1.24.0 System : Linux ip-172-31-5-206 6.14.0-1015-aws #15~24.04.1-Ubuntu SMP Tue Sep 23 22:44:48 UTC 2025 x86_64 User : ( 1001) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/quditinfotech.com/ |
Upload File : |
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
if($_SERVER["REQUEST_METHOD"] == "POST") {
$mail_to = "operations@quditinfotech.com";
$subject = "Conatct Us Messages From Qudit Infotech Website";
$name = str_replace(array("\r","\n"),array(" "," ") , strip_tags(trim($_POST["name"])));
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
$phone = trim($_POST["phone"]);
$message = trim($_POST["message"]);
if ( empty($name) OR !filter_var($email, FILTER_VALIDATE_EMAIL) OR empty($phone) OR empty($subject)) {
http_response_code(400);
echo "Please complete the form and try again.";
exit;
}
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
$secretKey = "6LdHCQseAAAAAFpwtyU0ESWaO6UdUsBR22Oiu_Zr";
$ip = $_SERVER['REMOTE_ADDR'];
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha) .'&remoteip='.urlencode($ip);
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if($responseKeys["success"]) {
$content = "Name: $name\n";
$content .= "Email: $email\n\n";
$content .= "Phone: $phone\n";
$content .= "Specifications/Requirement/Message:\n$message\n";
try {
$mail->isSMTP();
$mail->Host = 'email-smtp.ap-south-1.amazonaws.com';
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->Username = 'AKIA5VRRXS5NHE5RPZOO';
$mail->Password = 'BEB58VJ5vUynAQO2PmPm6PN6xVrgvaC8AZ5c3laX/dSc';
$mail->Port = 587;
$mail->setFrom('website@quditinfotech.com', 'FROM QUDIT INFOTECH WEBSITE CONTACT FORM');
$mail->addAddress($mail_to); //Add a recipient
$mail->addReplyTo($email);
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $content;
$success =$mail->send();
if ($success) {
http_response_code(200);
echo "Thank You! Your message has been sent.";
} else {
http_response_code(500);
echo "Oops! Something went wrong, we couldn't send your message.";
}
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
exit();
}
} else {
http_response_code(403);
echo "There was a problem with your submission, please try again.";
}
} else {
http_response_code(400);
echo "Please verify captcha.";
exit;
}
}
?>