function send() { $Message = new mContact(); $Message->__post(); if ($Message->validate()) { $Customer = new mCustomer(); $Customer->email = $Message->email; if ($Customer->load()) { $Message->customer = $Customer->id(); } //Save and send $Message->save(); $Email = new mailer(); $Email->sendContactForm($Message); $Email->sendAdminContactConfirm($Message); $this->display('sent'); } else { data('send-error', 'The form is not complete'); $this->display('form'); } }