require_once("conn.php");
$_SESSION['current']='index';
$name = $email = $message = "";
$msg = "Give us a shout! We always love hearing from customers " .
"and tire kickers.
Feature suggestions welcome. Constructive " .
"criticism welcome.
Most any type of comment is welcome as long as " .
"it\'s not hateful.";
if (array_key_exists('captcha', $_POST)) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if (strtoupper($_POST['captcha']) == $_SESSION['captcha']) {
//Don't run this unless we're handling a form submission
date_default_timezone_set('Etc/UTC');
require 'PHPmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
// $mail->SMTPDebug = 3;
$mail->Host = 'mail.cupworx.com';
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->isHTML(true);
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Username = "support@cupworx.com";
$mail->Password = "receiptpass$#@";
$mail->setFrom('support@cupworx.com', $name);
$mail->addReplyTo($email, $name);
$mail->addAddress('support@cupworx.com', 'Information Request');
// $mail->addAddress('ben.casebolt@gmail.com', 'Information Request');
$mail->Subject = 'Request for Information';
$mail->msgHTML($message);
//send the message, check for errors
if (!$mail->send()) {
$msg = "Mailer Error: " . $mail->ErrorInfo;
} else {
$q = "INSERT INTO emails(cupid,sentbyName,sentbyEmail,sharemsg)" .
"VALUES('contact','".$name."','".$email."','".$message."');";
//echo $q;
$r = $connection->query($q) or die($connection->error);
$msg = "Message sent! Thank you!";
}
}
else {
$msg = "Please re-enter the captcha";
}
}
?>