public function send($id) { $this->db->trans_begin(); try { $this->invoice->sendStatus = '1'; $this->invoice->due_date = add_date(date('Y-m-d'), 1, 0, 0); $updateInvoice = $this->invoice->update($id, $this->invoice); $data = array('email_from' => '*****@*****.**', 'name_from' => 'Taryono', 'email_to' => '*****@*****.**', 'email_subject' => 'Invoice', 'message' => 'test'); if (!sending_email($data)) { throw new ErrorException('send email failed'); } $this->db->trans_commit(); return json_view('success'); } catch (ErrorException $e) { $this->db->trans_rollback(); return json_view('failed => ' . $e->getMessage()); } }
public function send_verified_email($email, $token) { $message = "Please click this url : " . base_url('register/verified/' . $token) . " to email verification!"; $data = array('email_from' => '*****@*****.**', 'name_from' => 'KHANSA TRADER', 'email_to' => $email, 'email_subject' => 'Invoice', 'message' => $message); return sending_email($data); }