isSMTP(); $mail->Host = 'smtp.gmail.com'; // Replace with your SMTP server $mail->SMTPAuth = true; $mail->Username = 'sspappkee@gmail.com'; // Replace with your email $mail->Password = 'pkqwvwbjsunljqpg'; // Replace with your email password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Use TLS encryption $mail->Port = 587; // Usually 587 for TLS, 465 for SSL // Email Headers $mail->setFrom('sspappkee@gmail.com', 'Enquiry Form'); // Replace with your email and name $mail->addAddress('saurabh.ssp01@gmail.com', 'Admin'); // Replace with recipient email // Email Content $mail->isHTML(true); $mail->Subject = 'New Enquiry'; $mail->Body = "

Contact Form Submission

First Name: $name

Email: $email

Phone: $phone

Message: $message

"; // Send Email if ($mail->send()) { echo "Email sent successfully!"; echo ""; } else { echo "Failed to send email."; } } catch (Exception $e) { echo json_encode(["status" => "error", "message" => "Mailer Error: " . $mail->ErrorInfo]); } } else { echo json_encode(["status" => "error", "message" => "Invalid Request"]); } ?>