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/acadevo.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/acadevo.in/home-mail.php
<?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['form_name']) || empty($_POST['form_email'])) {
        echo json_encode(['status' => 'error', 'message' => 'Name and email are required.']);
        exit;
    }

    $name = htmlspecialchars($_POST['form_name']);
    $email = htmlspecialchars($_POST['form_email']);
    $phone = htmlspecialchars($_POST['form_phone']);
    $message = htmlspecialchars($_POST['form_message']);

    $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', 'Acadevo');
        $mail->addAddress('apurbakhanra09@gmail.com', 'Leads'); // Change recipient email
        $mail->addReplyTo($email, $name);

        // Email content
        $mail->isHTML(true);
        $mail->Subject = 'Acadevo Home Leads Form Submission';
        $mail->Body = "
            <h3>Acadevo Home Leads Form Submission</h3>
            <p><strong>Name:</strong> $name</p>
            <p><strong>Email:</strong> $email</p>
            <p><strong>Phone Number:</strong> $phone</p>
            <p><strong>Message:</strong> $message</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;
}
?>

MMCT - 2023