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/ncriptech/ |
[ 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") { $first_name = htmlspecialchars($_POST['first_name']); $last_name = htmlspecialchars($_POST['last_name']); $city = htmlspecialchars($_POST['city']); $country_id = htmlspecialchars($_POST['country_id']); $email = htmlspecialchars($_POST['email']); $looking_for = htmlspecialchars($_POST['looking_for']); $contact_category_id = htmlspecialchars($_POST['contact_category_id']); $contact_subcategory_id = htmlspecialchars($_POST['contact_subcategory_id']); $contact_number = htmlspecialchars($_POST['contact_number']); $company_name = htmlspecialchars($_POST['company_name']); $message = htmlspecialchars($_POST['message']); // 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('apurbakhanra09@gmail.com'); // Replace with your email // Email content $mail->isHTML(true); $mail->Subject = 'New Contact Form Submission'; $mail->Body = "You have received a new message:<br><br> <b>First_name:</b> $first_name<br> <b>Last name:</b> $last_name<br> <b>City:</b> $city<br> <b>Country:</b> $country_id<br> <b>Email:</b> $email<br> <b>Purpose of Contact:</b> $looking_for<br> <b>Select a Service:</b> $contact_category_id<br> <b>Service Subcategory:</b> $contact_subcategory_id<br> <b>Contact number:</b> $contact_number<br> <b>Company name:</b> $company_name<br> <b>Messege:</b> $message<br> "; // Send the email $mail->send(); echo 'ok'; } catch (Exception $e) { echo "error {$mail->ErrorInfo}"; } } else { echo "error"; } ?>