public function action_contact() { $errors = false; if ($_POST) { $val = Validation::factory($_POST); $val->rule('sprot', 'exact_length', array(':value', 1)); $val->rule('email', 'not_empty'); $val->rule('email', 'email'); $val->rule('suggestion', 'not_empty'); if ($val->check()) { notes::success('Your message has been sent and we will get back to you as soon as possible. Thanks!'); $mail = mail::create('suggestion')->to('*****@*****.**')->from(arr::get($_POST, 'email', ''))->content(arr::get($_POST, 'suggestion') . '<br /><br />.E-mail: ' . arr::get($_POST, 'email', ''))->subject('Message to ' . site::option('sitename'))->send(); site::redirect('contact'); } else { $errors = $val->errors('suggestions'); } } $this->bind('errors', $errors); seo::instance()->title("Contact Morning Pages"); seo::instance()->description("Feel free to contact MorningPages.net if you have questions or concerns about your account, the site or for more information regarding your Morning Pages."); }
$this->from = $email; return $this; } public function send() { $this->save(); $from = site::option('emailfrom'); if ($this->from) { $from = $this->from; } $headers = "Content-type: text/html; charset=UTF-8\r\nFrom:" . site::option('sitename') . " <" . $from . ">"; $message = View::factory('templates/mail'); $message->mail = $this; try { if (mail($this->to, $this->subject, $message, $headers)) { $this->sent = time(); $this->save(); return true; } } catch (exception $e) { Log::instance()->exception('Couldnt send mail! ID: ' . $this->id, $e);