MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
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 : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home/celkcksm/murchhana.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/murchhana.com/mail.php
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'php_mailer/Exception.php';
require 'php_mailer/PHPMailer.php';
require 'php_mailer/SMTP.php';

header('Content-Type: application/json');

try {
    // Sanitize and validate input
        $name = $_POST['name'] ?? '';
        $phone = $_POST['phone'] ?? '';
        $eventType = $_POST['eventType'] ?? '';
        $eventDate = $_POST['eventDate'] ?? '';
        $guests = $_POST['guests'] ?? '';
        $message = $_POST['message'] ?? '';

    // Basic validation
    if (empty($name) || empty($phone) || empty($eventType) || empty($eventDate)) {
        http_response_code(400);
        echo json_encode(['error' => 'All fields are required.']);
        exit;
    }

    $mail = new PHPMailer(true);

    // Server settings
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com'; // Replace with your SMTP host
    $mail->SMTPAuth = true;
    $mail->Username = 'waytoadmissions21@gmail.com'; // Replace with your SMTP username
    $mail->Password = 'lgle pkre mzzy sebw'; // Replace with your SMTP password or app-specific password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
    $mail->Port = 465;

    // Recipients
    $mail->setFrom($email, "$name");
    $mail->addAddress('apurbakhanra09@gmail.com'); // Replace with recipient email

    // Content
    $mail->isHTML(true);
    $mail->Subject = 'Booking Request';
    $mail->Body = "
            <h2>New Booking Request</h2>
            <p><strong>Name:</strong> $name</p>
            <p><strong>Phone:</strong> $phone</p>
            <p><strong>Event Type:</strong> $eventType</p>
            <p><strong>Event Date:</strong> $eventDate</p>
            <p><strong>Guests:</strong> $guests</p>
            <p><strong>Message:</strong> $message</p>
            
    ";

    

    $mail->send();
    echo json_encode(['success' => true]);

} catch (Exception $e) {
    echo json_encode(['success' => false, 'message' => 'Email could not be sent. Error: ' . $mail->ErrorInfo]);
}

?>

MMCT - 2023