Server IP : 103.191.208.50 / Your IP : 216.73.216.226 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/celkcksm/murchhana.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'phpmailer/Exception.php'; require 'phpmailer/PHPMailer.php'; require 'phpmailer/SMTP.php'; header('Content-Type: text/plain; charset=utf-8'); // Set response type to JSON if ($_SERVER["REQUEST_METHOD"] == "POST") { $response = ['status' => 'error', 'message' => 'Something went wrong.']; // Validate required fields // if (empty($_POST['name']) || empty($_POST['email'])) { // echo json_encode(['status' => 'error', 'message' => 'Name and email are required.']); // exit; // } $name = htmlspecialchars($_POST['name']); $email = htmlspecialchars($_POST['email']); $phone = htmlspecialchars($_POST['phone']); $event = htmlspecialchars($_POST['event']); $mail = new PHPMailer(true); try { // SMTP Configuration $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = 'waytoadmissions21@gmail.com'; // Use your Gmail address $mail->Password = 'lgle pkre mzzy sebw'; // Use the generated App Password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; // 465 // 587 // Sender and recipient $mail->setFrom('apurbakhanra09@gmail.com', 'Murchhana'); $mail->addAddress('apurbakhanra09@gmail.com', 'Enquiry'); // Change recipient email $mail->addReplyTo($email, $name); // Email content $mail->isHTML(true); $mail->Subject = 'Murchhana Event Booking Enquiry'; $mail->Body = " <h3>Murchhana Event Booking Enquiry</h3> <p><strong>Name : </strong> $name</p> <p><strong>Email : </strong> $email</p> <p><strong>Phone Number : </strong> $phone</p> <p><strong>Event : </strong> $event</p> "; if ($mail->send()) { $response = ['status' => 'success', 'message' => 'Message sent successfully.']; } else { $response = ['status' => 'error', 'message' => 'Mail could not be sent.']; } } catch (Exception $e) { $response = ['status' => 'error', 'message' => "Mailer Error: {$mail->ErrorInfo}"]; } echo json_encode($response); exit; } ?>