view->headMeta(); if($this->getRequest()->isPost()) { $body = strip_tags($_POST['question']); $name = strip_tags($_POST['first_name'] . ' ' . $_POST['last_name']); $business = strip_tags($_POST['business_name']); $phone = strip_tags($_POST['phone']); $email = strip_tags($_POST['email']); $result = $this->validate($_POST); if(sizeof($result) == 0) { $mail = new Zend_Mail(); $mail->setBodyText($this->get_text_message($name, $body, $business, $phone, $email, $recipient)); $mail->setBodyHtml($this->get_message($name, $body, $business, $phone, $email, $recipient)); $mail->setFrom('web_questions@guarantytitle.net', 'Web Question'); $mail->addTo('Michelle Kolling', 'mkolling@guarantytitle.net'); $mail->setSubject("Website Form: $name has a question!"); $mail->send(); $this->view->errors = false; } else { $this->view->errors = $result; } } } private function validate($fields) { $result = array(); foreach($fields as $field => $value) { if($field != 'business_name') { if(empty($value)) { $english = ucwords(str_replace('_', " ", $field)); array_push($result, "$english cannot be blank"); } } } return $result; } private function get_message($name, $body, $business, $phone, $email, $recipient) { $date = date('F j, Y'); $time = date("g:i a"); $message=<<

Hello {$recipient['name']},

It's $time on $date and $name filled out the contact form at GuarantyTitle.net. Here is what they had to say:

Name: $name
Email: $email
Phone: $phone
Business: $business

Question

$body



This message was auto-generated by guarantytitle.net, please do not reply

MESSAGE; return $message; } private function get_text_message($name, $body, $business, $phone, $email, $recipient) { $date = date('F j, Y'); $time = date("g:i a"); $message=<<