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/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?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['news_name']); $email = htmlspecialchars($_POST['news_email']); // 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 = 'ncriptech1@gmail.com'; // Your Gmail address $mail->Password = 'jigh mrpm wamg kodq'; // Your Gmail App Password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; // Set the sender (user's email from the form) $mail->setFrom($email, $name); // Recipient email (your email to receive the form data) $mail->addAddress('ncriptech@gmail.com'); // Replace with your email // Email content $mail->isHTML(true); $mail->Subject = 'New Form Submission'; $mail->Body = "You have received a new message:<br><br> <b>Name:</b> $name<br> <b>Email:</b> $email<br>"; // Send the email $mail->send(); echo 'ok'; } catch (Exception $e) { echo "error {$mail->ErrorInfo}"; } } else { echo "error"; } ?>