Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Email($data) {
- $this->cart->destroy();
- $this->load->model('barang');
- $this->load->model('Cart');
- $this->load->model('content');
- $datacontent = $this->content->getDataContent();
- $idPenjualan = array('Id'=>$data[0]['idPenjualan']);
- $result = $this->Cart->getDataPenjualan($idPenjualan);
- if($result[0]['transverVia']=='BCA') {
- $result[0]['nomorRekening'] = $datacontent[0]['nomorRekening1'];
- $result[0]['anBank'] = $datacontent[0]['anBank1'];
- }
- else if($result[0]['transverVia']=='BNI') {
- $result[0]['nomorRekening'] = $datacontent[0]['nomorRekening2'];
- $result[0]['anBank'] = $datacontent[0]['anBank2'];
- }
- else if($result[0]['transverVia']=='Mandiri') {
- $result[0]['nomorRekening'] = $datacontent[0]['nomorRekening3'];
- $result[0]['anBank'] = $datacontent[0]['anBank3'];
- }
- $dataPenjualan['Penjualan'] = $result;
- $dataPenjualan['DetailPenjualan'] = $data;
- /*
- echo "<pre>";
- print_r($dataPenjualan);
- echo "</pre>";
- */
- $dataEmail['dataPenjualan'] = $dataPenjualan;
- //-----------------------------------------------//
- $sender_email = "rizalubuntuuser@gmail.com";
- $user_password = "";
- //$receiver_email = "rizalubuntuuser@gmail.com";
- $username = 'Rizal';
- $subject = 'Republik Jaya Motor';
- $message = $this->load->view('email', $dataEmail, TRUE); ;
- $config['protocol'] = 'smtp';
- $config['smtp_host'] = 'ssl://smtp.googlemail.com';
- $config['smtp_port'] = 465;
- $config['smtp_user'] = $sender_email;
- $config['smtp_pass'] = $user_password;
- $config['mailtype'] = 'html';
- $config['charset'] = 'utf-8';
- // Load email library and passing configured values to email library
- $this->load->library('email', $config);
- $this->email->set_newline("\r\n");
- // Sender email address
- $this->email->from($sender_email, $username);
- // Receiver email address
- $this->email->to($result[0]['email']);
- // Subject of email
- $this->email->subject($subject);
- // Message in email
- $this->email->message($message);
- if ($this->email->send()) {
- echo 'Email Successfully Send !';
- redirect('home');
- } else {
- echo '<p class="error_msg">Invalid Gmail Account or Password !</p>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement