success)
{
$succMsg = 'Your contact request have submitted successfully.';
}
else
{
$errMsg = '
Please click on the reCAPTCHA box.
';
}
}
if ($succMsg) {
$varDate = date("F j, Y");
$subj = "Web Contact Form from " . $_POST["email"];
$emess = "
";
$emess.= "Date : | " . $varDate . " |
";
$emess.= "Name: | " . $_POST["name"] . " |
";
$emess.= "Company Name: | " . $_POST["company"] . " |
";
$emess.= "Phone: | " . $_POST["phone"] . " |
";
$emess.= "e-mail: | " . $_POST["email"] . " |
";
$emess.= "Message: | " . $_POST["message"] . " |
";
$emess.= "
";
//Load Composer's autoloader
require 'inc/PHPMailer/vendor/autoload.php';
// email confirmation
$SendToEmail = "anamdar@namdarrealty.com";
// $SendToEmail = "fnamdar@nexium.com";
$SenderEmail = "webmail@namdarrealty.com";
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Host = 'smtp.ionos.com'; // Specify main and backup SMTP servers
$mail->Username = 'webmail@namdarrealty.com'; // SMTP username
$mail->Password = '#NR26web'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($SenderEmail, 'NamdarRealty.com Contact');
$myemail = explode(",",$SendToEmail);
foreach($myemail as $address){
$mail->addAddress($address, 'Namdar Realty Webmail'); // Add a recipient
}
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subj;
$mail->Body = $emess;
$mail->send();
} catch (Exception $e) {
$varValid = false;
}
$sqlText = "INSERT INTO WebContact(Date, Name, Company, Phone, Email, Message) VALUES ('". date("Y-m-d H:i:s") ."', '". mysqli_real_escape_string($connect,$_POST["name"]) . "', '". mysqli_real_escape_string($connect,$_POST["company"]) . "', '". mysqli_real_escape_string($connect,$_POST["phone"]) . "', '". mysqli_real_escape_string($connect,$_POST["email"]) . "', '". mysqli_real_escape_string($connect,$_POST["message"]) . "')";
if (!mysqli_query($connect,$sqlText))
die('Error: ' . mysqli_error() . $sqlText);
echo "
Thank you for contacting us. One of our representatives will contact you regarding your inquiry.
" ;
}
} else {
?>