CREATE FUNCTION SEND EMEL ( CONTROLLER FILE )
1. Create query ( baca drp database )
$id = $this->input->post('id'); \\ pass value
Contoh query :
$this->db->select('Member .*, member.emel');
$this->db->join('Login', 'Member.loginName = Login.loginName');
$this->db->where('Login.loginName = "'.$id.'"');
$query = $this->db->get('Member');
$hantaremel = $query->result_array();
foreach ($hantaremel as $key => $val) {
$this->load->library('email');
$this->email->set_mailtype("html");
$this->email->from('admin@com.my');
$this->email->to($val['emel']); \\ sistem akan semak dan hantar ke akaun emel yang ada berdasarkan output query di atas.
$this->email->cc('');
$this->email->bcc('');
$this->email->subject('');
$this->email->message( "");
$this->email->send();
}
0 comments:
Post a Comment