File: /home/rtbrisc/www/mailer/index.php
<?php
require_once "phpmailer/class.phpmailer.php";
//To Handle Session Variables on This Page
session_start();
$name = $_POST['txtName'];
$email = $_POST['txtEmail'];
$unit = $_POST['txtUnit'];
$number = $_POST['txtNumber'];
$subject = $_POST['txtSubject'];
$message = $_POST['txtMessage'];
$origin = $_POST['txtOrigin'];
if ($origin == "book_quote") {
$reciever = "customerservice@rtbriscoe.com";
} else {
$reciever = "customerservice@rtbriscoe.com";
}
$message = '<html><head>
<title>R.T. Briscoe</title>
</head>
<body>';
$message .= '<h2> Hello R.T. Briscoe,</h2><br>';
$message .= '<h2> My name is ' . $name .'!</h2><br>';
$message .= '<h4>' . $subject . '</h4><br>';
$message .= '<h4>' . $message . '</h4><br>';
$message .= '<table><tr><th align="left">Email</th><th align="left">Email</th><th align="left">Business Unit</th><th align="left">Phone Number</th><tr>';
$message .= '<tr><td>' . $email . '</td><td>' . $unit . '</td><td>' . $number . '</td></tr></table>';
$message .= "</body></html>";
// php mailer code starts
$mail = new PHPMailer(true);
//$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = 'qisnigeria@gmail.com';
$mail->Password = 'Qis2018@';
$mail->SetFrom('no-reply@rtbriscoe.com.com', 'R.T. Briscoe');
$mail->AddAddress($reciever);
$mail->Subject = trim($subject);
$mail->MsgHTML($message);
if($mail->send()) {
$_SESSION['sent'] = "Your Quote has been recieved, we will contact you shortly!!!";
header("Location: ../sent.php");
}else{
$_SESSION['sent'] = "Your Quote could not be sent. Please call any of our contact lines.";
header("Location: ../sent.php");
}
?>