Contact Neighborhood Church of Anderson Cottonwood
You left out your email address';
}
else if(checkEmail($email))
{
$errmsg = 'Your email address is not valid';
}
else if(trim($subject) == '')
{
$errmsg = 'You left out the subject';
}
else if(trim($message) == '')
{
$errmsg = 'You left out your message';
}
return $errmsg;
}
function checkEmail($email)
{
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if (preg_match('/[a-z0-9\.\_\-]+\@[a-z0-9\_\-]+(.[a-z0-9\.\_\-]+)+/', $email))
{ //checks to make sure the email address is in a valid format
return false;
}
return true;
}
function process_form()
{
require_once('../phpmailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$name = htmlentities($_POST['name']);
$email = htmlentities($_POST['email']);
$subject = htmlentities($_POST['subject']);
$message = htmlentities($_POST['message']);
if(get_magic_quotes_gpc())
{
$subject = stripslashes($subject);
$message = stripslashes($message);
}
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$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 = "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
"; // GMAIL username
$mail->Password = "Sat-sri-akal215"; // GMAIL password
$mail->From = $email;
$mail->FromName = $name;
$mail->AddReplyTo($email, $name);
$mail->AddAddress("
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
", "Website");
$mail->Subject = $subject . " | www.KnightlyComputing.com";
$mail->MsgHTML($message);
if($mail->Send())
$msg = 'Message was sent. Thanks!';
else
$msg = 'Message was not sent. Mailer Error: ' . $mail->ErrorInfo . '';
echo "
" . $msg . "
";
}
function show_form($form_msg)
{
$Subject = "";
if ($_GET["hostingPlan"] != "")
{
$Subject = "Sign me up for your " . $_GET["hostingPlan"] . " hosting plan";
}
?>