📁 File Manager
Editing:
/home/wedigitalindia/public_html/home-wedigitalindia/epperporta/mail.php
<?php session_start(); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require 'vendor/vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Sanitize input $fullname = htmlspecialchars(strip_tags($_POST['fullname'])); $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); $phone = htmlspecialchars(strip_tags($_POST['phone'])); $message = htmlspecialchars(strip_tags($_POST['message'])); $cabintype = htmlspecialchars(strip_tags($_POST['cabintype'])); // Email to Admin $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'smtp.hostinger.com'; $mail->SMTPAuth = true; $mail->Username = 'admin@epperporta.com'; $mail->Password = 'P0a7EH2yE@eD'; // Use env file for real projects $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $mail->Port = 465; $mail->setFrom('admin@epperporta.com', 'Epper Porta'); $mail->addAddress('nishant@epperporta.com'); $mail->addAddress('pawankatoch96@gmail.com'); $mail->isHTML(true); $mail->Subject = 'New Contact Enquiry - Epper Porta'; $mail->Body = " <div style='font-family: Arial, sans-serif; font-size: 14px;'> <hr color='#369'> <p><strong>Hello Admin,</strong></p> <p>You have received a new contact form enquiry:</p> <p><strong>Full Name:</strong> $fullname</p> <p><strong>Email:</strong> $email</p> <p><strong>Phone:</strong> $phone</p> <p><strong>Cabin Type:</strong> $cabintype</p> <p><strong>Message:</strong> $message</p> <hr color='#369'> </div> "; $mail->send(); // Now send thank you email to the user $userMail = new PHPMailer(true); $userMail->isSMTP(); $userMail->Host = 'smtp.hostinger.com'; $userMail->SMTPAuth = true; $userMail->Username = 'admin@epperporta.com'; $userMail->Password = 'P0a7EH2yE@eD'; $userMail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $userMail->Port = 465; $userMail->setFrom('admin@epperporta.com', 'Epper Porta'); $userMail->addAddress($email, $fullname); $userMail->isHTML(true); $userMail->Subject = 'Thank You for Contacting Us'; $userMail->Body = " <div style='font-family: Arial, sans-serif; font-size: 14px;'> <p>Dear $fullname,</p> <p>Thank you for submitting your travel enquiry with Epper Porta.</p> <p>We have received your details and our team will get back to you shortly.</p> <br> <p>Warm regards,<br><strong>Epper Porta</strong></p> </div> "; $userMail->send(); echo "<script>location.href='thank-you.php';</script>"; } catch (Exception $e) { echo "Mailer Error: {$mail->ErrorInfo}"; } } ?>
Save
Cancel