![]() |
![]() ![]() |
![]() |
![]() |
![]() ![]() |
require_once "Mail.php"; $bool = 0; if(array_key_exists("submit",$_POST)){ // Code for captcha image... //include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php'; //$securimage = new Securimage(); //if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // print ("The code you entered was incorrect. Go back and try again. Please try again.\n"); //} else { if(!empty($_POST['website'])) exit(); $text = $_POST['cquest']; // Write all transactions to a log. date_default_timezone_set('America/New_York'); $timestamp = date('m/d/Y H:i:s'); $myFile = "./logs/contact-us.log"; $fh = fopen($myFile, 'a') or die("can't open file"); fwrite($fh, "${timestamp}\n"); fwrite($fh, "To: " . $_POST["to"] . "\n"); fwrite($fh, "From: " . $_POST["cname"] . " <" . $_POST["cemail"] . ">\n"); fwrite($fh, "Phone: " . $_POST["cphone"] . "\n"); fwrite($fh, $text); fwrite($fh, "\n---------------------------------------------\n"); fclose($fh); // Check for spam messages, and die() if this is suspected spam... if (preg_match("/.*sex|fuck|forex|Forex|girl for the night|intimate photos|google adsense|dating sites|dating apps|weight loss|casual dating|bitcoin|essay|cryptocurrency|Cryptocurrency|invest.*/i", $text)) { print ("Thank you for contacting us.\n"); exit(); } $whom = array("rav" => "[email protected]", "president" => "[email protected]", "gabbai" => "[email protected]", "treasurer" => "[email protected]", "membership committee" => "[email protected]", "nshei" => "[email protected]", "hospitality" => "[email protected]", "general" => "[email protected]", "catering" => "[email protected]", "rentals" => "[email protected]", "admin" => "[email protected]", "youth" => "[email protected]", "dinner" => "[email protected]"); $toWhom = $whom[$_POST["to"]]; if($toWhom != null && $toWhom != ""){ $to = $toWhom; $subject = "www.agudah5t.org Contact Form"; $mssg = "Contact: ".$_POST["cname"]."\nat: ".$_POST["cphone"]." or ".$_POST["cemail"]."\n\n".$_POST["cname"]." wrote:\n".$_POST["cquest"]; //$from = "From: ".$_POST["cemail"]; $from = $_POST["cemail"]; $smtp_host = "mail.agudah5t.org"; $smtp_user = "[email protected]"; $smtp_pw = "ddhk0na4QQ!"; $headers = array ( 'From' => $smtp_user, 'To' => $to, 'Subject' => $subject ); $smtp = Mail::factory( 'smtp', array ('host' => $smtp_host, 'auth' => true, 'username' => $smtp_user, 'password' => $smtp_pw) ); $bool = $smtp->send($to, $headers, $mssg); //$bool = mail($to, $subject, $mssg, $from); //if($bool == 1){ if (! PEAR::isError($bool)) { ?> Thank you for contacting the ! exit(); } else{ ?> 1 We're sorry. Something went wrong trying to send this email. Please try again. |