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 (0755) : /home/celkcksm/gtsgmbh.ncriptech.com/dev/saltora-apurba/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?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 $fname = htmlspecialchars(trim($_POST['fname'])); $lname = htmlspecialchars(trim($_POST['lname'])); $email = htmlspecialchars(trim($_POST['email'])); $phone = htmlspecialchars(trim($_POST['Phone'])); $address = htmlspecialchars(trim($_POST['address'])); $city = htmlspecialchars(trim($_POST['city'])); $country = htmlspecialchars(trim($_POST['country'])); $zip = htmlspecialchars(trim($_POST['zip'])); $date = htmlspecialchars(trim($_POST['datepicker'])); $subject = htmlspecialchars(trim($_POST['subject'])); $message = htmlspecialchars(trim($_POST['msg'])); // Basic validation if (empty($fname) || empty($lname) || empty($email) || empty($phone) || empty($address) || empty($city) || empty($country) || empty($zip) || empty($date)) { echo json_encode(['status' => 'error', 'message' => 'All required fields must be filled.']); 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, "$fname $lname"); $mail->addAddress('salbed255@gmail.com'); // Replace with recipient email // Content $mail->isHTML(true); $mail->Subject = 'New Form Submission'; $mail->Body = " <h2>New Form Submission</h2> <p><strong>First Name:</strong> $fname</p> <p><strong>Last Name:</strong> $lname</p> <p><strong>Email:</strong> $email</p> <p><strong>Phone:</strong> $phone</p> <p><strong>Address:</strong> $address</p> <p><strong>City:</strong> $city</p> <p><strong>Country:</strong> $country</p> <p><strong>Zip Code:</strong> $zip</p> <p><strong>Date:</strong> $date</p> <p><strong>Subject:</strong> $subject</p> <p><strong>Message:</strong> $message</p> "; $mail->AltBody = "First Name: $fname\nLast Name: $lname\nEmail: $email\nPhone: $phone\nAddress: $address\nCity: $city\nCountry: $country\nZip Code: $zip\nDate: $date\nSubject: $subject\nMessage: $message"; $mail->send(); echo json_encode(['success' => true]); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Email could not be sent. Error: ' . $mail->ErrorInfo]); } ?>