File: /var/www/html/balaji-properties-dev/send-mail.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require('PHPMailer/src/Exception.php');
require('PHPMailer/src/PHPMailer.php');
require('PHPMailer/src/SMTP.php');
/**
* Send email to admin when a user submits a leasing inquiry form
*/
function sendMail($name = '', $email = '', $phone = '', $message = '', $pageName = '', $requestType = 'Leasing Inquiry')
{
$mail = new PHPMailer(true);
try {
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'smtp.mailgun.org';
$mail->SMTPAuth = true;
$mail->Username = 'support@flyblaze.com';
$mail->Password = 'smtpFlyblaze@2025';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
// Sender and recipient
$mail->setFrom('support@flyblaze.com', 'Balaji Properties');
$mail->addAddress('rishi@balajiproperties.org', 'Balaji Properties');
$mail->addBCC('rohit@cccinfotech.com', 'Support');
// Subject & format
$mail->Subject = 'New ' . $requestType;
$mail->isHTML(true);
// Email body for admin
$mailContent = "
<h2>New Leasing Inquiry Received</h2>
<p>Dear Rishi,</p>
<p>A new leasing inquiry has been submitted through the Balaji Properties website. Please find the details below:</p>
<p><strong>Name:</strong> {$name}</p>
<p><strong>Email:</strong> {$email}</p>
<p><strong>Phone:</strong> {$phone}</p>
<p><strong>Message:</strong> {$message}</p>
<p><strong>Page Name:</strong> {$pageName}</p>
<hr>
<p>This inquiry may relate to <strong>Shop Leasing</strong>, <strong>Retail Spaces</strong>, or <strong>F&B Restaurant Leasing</strong>.</p>
<p>Please reach out to the client at the earliest convenience.</p>
";
$mail->Body = $mailContent;
$mail->send();
return true;
} catch (Exception $e) {
error_log("Admin Mail Error: " . $mail->ErrorInfo);
return false;
}
}
/**
* Send confirmation email to user after form submission
*/
function sendUserMail($name = '', $email = '')
{
$mail = new PHPMailer(true);
try {
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'smtp.mailgun.org';
$mail->SMTPAuth = true;
$mail->Username = 'support@flyblaze.com';
$mail->Password = 'smtpFlyblaze@2025';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
// Sender & recipient
$mail->setFrom('support@flyblaze.com', 'Balaji Properties');
$mail->addAddress($email, $name);
// Subject & format
$mail->Subject = 'Thank You for Your Leasing Inquiry - Balaji Properties';
$mail->isHTML(true);
// Email body for user
$mail->Body = "
<h3>Dear {$name},</h3>
<p>Thank you for your interest in <strong>Balaji Properties</strong>.</p>
<p>We have received your inquiry regarding <strong>Shop, Retail, or F&B Restaurant Leasing</strong>.</p>
<p>Our leasing team will get in touch with you shortly to discuss available spaces, pricing, and location options tailored to your business needs.</p>
<p>If you have any additional queries, please contact us at
<a href='tel:+91-9810933399'><strong>+91-98109 33399</strong></a> or email us at
<a href='mailto:rishi@balajiproperties.org'>rishi@balajiproperties.org</a>.</p>
<br>
<p>Warm Regards,</p>
<p><strong>Team Balaji Properties</strong><br>
<a href='http://dev.cccinfotech.com/balaji-properties/'>www.balajiproperties.org</a></p>
<br>
<a href='http://dev.cccinfotech.com/balaji-properties/'>
<img src='http://dev.cccinfotech.com/balaji-properties/assets/images/header-logo.png'
alt='Balaji Properties Logo' style='width: 120px; height: auto;'>
</a>
";
$mail->send();
return true;
} catch (Exception $e) {
error_log("User Mail Error: " . $mail->ErrorInfo);
return false;
}
}
?>