 <?php

// require 'PHPMailer/src/Exception.php'; 
// require 'PHPMailer/src/PHPMailer.php'; 
// require 'PHPMailer/src/SMTP.php';
// use PHPMailer\PHPMailer\PHPMailer; 
// use PHPMailer\PHPMailer\Exception; 

// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
//     $name = $_POST['name'];
//     $productname = $_POST['productname'];
//     $quantity = $_POST['quantity'];
//     $email = $_POST['email'];
//     $cn = $_POST['cn'];
    
//     $mail = new PHPMailer;
//     $mail->isSMTP();
//     $mail->SMTPDebug = 2;
//     $mail->Host = 'smtp.hostinger.com';
//     $mail->Port = 587;
//     $mail->SMTPAuth = true;
//     $mail->Username = 'info@primehealthpharma.com';
//     $mail->Password = 'Primeinfo@2025';
//     $mail->setFrom('info@primehealthpharma.com', 'Prime Health Pharma');
//     $mail->addReplyTo('info@primehealthpharma.com', 'Support');
//     $mail->addAddress('info@primehealthpharma.com', 'Admin');
//     $mail->Subject = 'Enquiry Mail From Primehealthpharma Website';
    
//     // Creating email body
//     $body = "<h3>New Product Order Details</h3>";
//     $body .= "<p><strong>Name:</strong> $name</p>";
//     $body .= "<p><strong>Product Name:</strong> $productname</p>";
//     $body .= "<p><strong>Quantity:</strong> $quantity</p>";
//     $body .= "<p><strong>Email:</strong> $email</p>";
//     $body .= "<p><strong>Contact Number:</strong> $cn</p>";
    
//     $mail->isHTML(true);
//     $mail->Body = $body;
    
//     if (!$mail->send()) {
    
//         echo 'Mailer Error: ' . $mail->ErrorInfo;
//     } else {
//         // echo 'The email message was sent successfully.';
//          header('Location: thank-you.html');
//     }
// } else {
//     echo 'Invalid request method.';
// }




require 'PHPMailer/src/Exception.php'; 
require 'PHPMailer/src/PHPMailer.php'; 
require 'PHPMailer/src/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer; 
use PHPMailer\PHPMailer\Exception; 

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['cno'];
    $msg = $_POST['Message'];

    
    $mail = new PHPMailer;
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->Host = 'smtp.hostinger.com';
    $mail->Port = 587;
    $mail->SMTPAuth = true;
    $mail->Username = 'info@vmgexports.in';
    $mail->Password = 'Vmginfo@2025';
    $mail->setFrom('info@vmgexports.in', 'vmgexports');
    $mail->addReplyTo('info@vmgexports.in', 'Support');
    $mail->addAddress('info@vmgexports.in', 'Admin');
    $mail->Subject = 'Enquiry Mail From vmgexports Website';
    
    // Creating email body
    $body = "<h3>New Enquiry Details</h3>";
    $body .= "<p><strong>First Name:</strong> $name</p>";
    $body .= "<p><strong>Email:</strong> $email</p>";
    $body .= "<p><strong>Contact Number:</strong> $phone</p>";
    $body .= "<p><strong>Message:</strong> $msg</p>";

    
    $mail->isHTML(true);
    $mail->Body = $body;
    
    if ($mail->send()) {
        
        header('Location: thanks.html');
    } else {
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
} else {
    echo 'Invalid request method.';
}
?>

