function send($id = FALSE) { if ($_POST) { $this->load->library('email'); $this->email->from($_POST["email"], $_POST["name"]); $user = new User($id); $this->email->to($user->email); //$this->email->to('*****@*****.**'); $this->email->bcc('*****@*****.**'); $this->email->subject($_POST["title"]); $this->email->message($_POST["detail"]); if ($_FILES['attach']['name']) { $executives = new Executive(); $_POST['attach'] = $executives->upload($_FILES['attach'], 'uploads/attachment/'); $this->email->attach('uploads/attachment/' . $_POST['attach']); } $this->email->send(); //echo $this->email->print_debugger(); set_notify('success', 'ส่งข้อความเรียบร้อย'); echo '<script type="text/javascript"> parent.location = unescape(parent.location.pathname); </script> '; //$this->load->view('sendmail'); } }