protected function _getContactForm($id) { require_once APPLICATION_PATH_COMMONS . '/forms/Contact.php'; $form = new Form_Contact(); if ($id > 0) { $form->setAction($this->_helper->url('form/?id=' . $id)); } else { $form->setAction($this->_helper->url('form')); } return $form; }
public function post_index() { $validation = Form_Contact::Validate(Input::all()); if ($validation === true) { $email = Config::get('email.contact'); $body = "Nom: " . Input::get('nom') . "\n"; $body .= "Email: " . Input::get('email') . "\n"; if (Input::has('sujet')) { $body .= "Sujet: " . Input::get('sujet') . "\n"; } $body .= "Message:" . "\n" . Input::get('message'); $headers = 'From: "' . Input::get('nom') . ' "<' . Input::get('email') . '>' . "\n"; $headers .= 'Reply-To: ' . Input::get('email') . "\n"; $headers .= 'Content-Type: text/plain; charset="utf-8"' . "\n"; $headers .= 'Content-Transfer-Encoding: 8bit'; mail($email, 'Contact depuis Laravel.fr', $body, $headers); return Redirect::to_action('contact@sent'); } else { return Redirect::to_action('contact')->with_errors($validation->errors)->with_input(); } }