include("/home/cbhprope/public_html/gasper/_inc/mail/Mail.php"); include("/home/cbhprope/public_html/gasper/_inc/dbconnect.inc"); include("/home/cbhprope/public_html/gasper/_inc/admin.inc"); $id = isset($_GET['id']) ? $_GET['id'] : $_POST['id']; // load the member passed in $agent = Admin::getInstanceOnCrestId($id); if (isset($agent) == false) { $iderr = "There was a problem, please close the window and try again."; $id = ""; } else if (isset($_POST['btnSubmit'])) { $lname = $_POST["lname"]; $fname = $_POST["fname"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $question = $_POST["questions"]; if (strlen(trim($lname)) == 0 || strlen(trim($fname)) == 0) { $err = "First and Last Names and either Email Address or Phone Number are required."; } else if (strlen(trim($email)) == 0 && strlen(trim($phone)) == 0) { $err = "First and Last Names and either Email Address or Phone Number are required."; } else if (strlen(trim($question)) == 0) { $err = "Please enter a question or comment."; } if (isset($err) == false) { $mailto = $agent->getEmail(); $mail_subject = 'Question from Website'; //the message subject (required) $mail_body = "This is a question from $fname $lname Name: $lname, $fname Email: $email Contact Phone: $phone Question(s): $question "; //the message body (required) $recipients = $mail_to; $headers['From'] = 'website@curtgasperteam.com'; $headers['To'] = $mail_to; $headers['Subject'] = $mail_subject; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('smtp', $params); $send = $mail_object->send($recipients, $headers, $mail_body); if (PEAR::isError($send)) { $errormsg = "There was a problem"; } else { $emailsent = "Y"; } $msg = "Thank you for submitting your question(s). I will get back to you as soon as possible."; } } ?>
$iderr
"; } else { ?>$msg
"; } else { if (isset($err)) { echo "First and Last Name are required as well as Email Address and/or Phone Number.
"; } ?> } } ?>