Assalamualaikum,.. berikut functionnya mas
$config = [
'mailtype' => 'html',
'charset' => 'utf-8',
'protocol' => 'smtp',
'smtp_host' => 'smtp.gmail.com',
'smtp_user' => 'email@gmail.com', // Email gmail
'smtp_pass' => 'passwordgmail', // Password gmail
'smtp_crypto' => 'ssl',
'smtp_port' => 465,
'crlf' => "\r\n",
'newline' => "\r\n"
];
// Load library email dan konfigurasinya
$this->load->library('email', $config);
// Email dan nama pengirim
$this->email->from($iden['email'], $iden['nama_website']);
// Email penerima
$this->email->to($email_tujuan); // Ganti dengan email tujuan
// Lampiran email, isi dengan url/path file
$this->email->attach('');
// Subject email
$this->email->subject($subject);
// Isi email
$this->email->message($message);
// Tampilkan pesan sukses atau error
if ($this->email->send()) {
echo 'Sukses! email berhasil dikirim.';
} else {
echo 'Error! email tidak dapat dikirim.';
}
// $this->email->from($iden['email'], $iden['nama_website']);
// $this->email->to($email_tujuan);
// $this->email->cc('');
// $this->email->bcc('');
// $this->email->subject($subject);
// $this->email->message($message);
// $this->email->set_mailtype("html");
// $this->email->send();
// $config['protocol'] = 'sendmail';
// $config['mailpath'] = '/usr/sbin/sendmail';
// $config['charset'] = 'utf-8';
// $config['wordwrap'] = TRUE;
// $config['mailtype'] = 'html';
$this->email->initialize($config);
$this->session->unset_userdata('idp');
$this->session->unset_userdata('reseller');
$this->template->load('bismillah/template','bismillah/view_order_success',$data);
}else{
redirect('produk/keranjang');
}
}else{
if ($this->session->id_konsumen==''){
redirect('auth/login');
}else{
$data['title'] = 'Data Pelanggan';
$data['provinsi'] = $this->model_app->view_ordering('rb_provinsi','provinsi_id','DESC');
$this->template->load('bismillah/template','bismillah/view_checkouts',$data);
$this->template->load(template().'/template',template().'/reseller/view_checkouts',$data);
}
}