|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/zapnixsemiconductor.com/include/ | |
|
Path: /home2/outerorb/zapnixsemiconductor.com/include/contact-mail.php
Size: 4.3 KB
Permissions: 0666
<?php
require __DIR__ . '/../PHPMailer/src/Exception.php';
require __DIR__ . '/../PHPMailer/src/PHPMailer.php';
require __DIR__ . '/../PHPMailer/src/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$fname = $_POST['fname'] ?? '';
$lname = $_POST['lname'] ?? '';
$email = $_POST['email'] ?? '';
$phone = $_POST['phone'] ?? '';
$message = $_POST['message'] ?? '';
if (!$fname || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
http_response_code(400);
exit('Invalid input');
}
$mail = new PHPMailer(true);
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; // full SMTP conversation
// $mail->Debugoutput = 'error_log';
try {
$mail->isSMTP();
$mail->Host = 'smtp.office365.com';
$mail->SMTPAuth = true;
$mail->Username = 'info@zapnixsemiconductor.com';
$mail->Password = 'wlqdgfzctgmhhfvw'; // real password here
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // or ENCRYPTION_SMTPS
$mail->Port = 587; // TLS 587 or SSL 465
// Recipients
$mail->setFrom('info@zapnixsemiconductor.com', 'Zapnix Semiconductor');
// $mail->addAddress('info@zapnixsemiconductor.com');
$mail->addAddress('abhinaykrmishra@gmail.com');
$mail->addReplyTo($email, $fname);
// Content
$mail->isHTML(true);
$mail->Subject = 'New Contact Form Submission';
$mail->Body = <<<HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>New Contact Form Submission</title>
</head>
<body style="margin:0;padding:0;background:#f5f7fa;font-family:Arial,Helvetica,sans-serif;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#f5f7fa;padding:20px 0;">
<tr>
<td align="center">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="max-width:600px;width:100%;background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 6px rgba(0,0,0,0.1);">
<tr>
<td style="background:#2b7cff;padding:24px 32px;color:#ffffff;font-size:22px;font-weight:bold;">
Zapnix Semiconductor – New Enquiry
</td>
</tr>
<!-- Body -->
<tr>
<td style="padding:32px;">
<p style="margin:0 0 16px 0;font-size:16px;color:#333333;">
You’ve received a new message via the website contact form:
</p>
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" style="font-size:15px;color:#333333;">
<tr>
<td style="padding:8px 0;width:120px;font-weight:bold;">Name:</td>
<td style="padding:8px 0;">{$fname} {$lname}</td>
</tr>
<tr>
<td style="padding:8px 0;width:120px;font-weight:bold;">Email:</td>
<td style="padding:8px 0;"><a href="mailto:{$email}" style="color:#2b7cff;">{$email}</a></td>
</tr>
<tr>
<td style="padding:8px 0;width:120px;font-weight:bold;">Phone:</td>
<td style="padding:8px 0;">{$phone}</td>
</tr>
<tr>
<td style="padding:8px 0;width:120px;font-weight:bold;">Message:</td>
<td style="padding:8px 0;">{$message}</td>
</tr>
</table>
<p style="margin:24px 0 0 0;font-size:14px;color:#888888;">
— Automatic notification from zapnixsemiconductor.com
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background:#f0f2f5;padding:16px 32px;text-align:center;font-size:12px;color:#8a8a8a;">
© 2025 Zapnix Semiconductor. All rights reserved.
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
HTML;
$mail->send();
echo 'success';
} catch (Exception $e) {
http_response_code(500);
echo "Mailer Error: {$mail->ErrorInfo}";
}
}
?>