Advertisement
j0h4n54ntr1

kirim email

Feb 19th, 2018
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Welcome extends CI_Controller {
  5.  
  6.     public function index()
  7.     {
  8.            
  9.        
  10.          $config = Array(  
  11.     'protocol' => 'smtp',  
  12.     'smtp_host' => 'ssl://smtp.googlemail.com',  
  13.     'smtp_port' => 465,  
  14.     'smtp_user' => 'emai@gmail.com',  //harus di set terlebih dahulu di gmail
  15.     'smtp_pass' => 'paswordgoogl',  
  16.     'mailtype' => 'html',  
  17.     'charset' => 'iso-8859-1'  
  18.    );  
  19.    $this->load->library('email', $config);  
  20.    $this->email->set_newline("\r\n");  
  21.    $this->email->from('email@gamil.com', 'Admin josan');  
  22.    $this->email->to('contoh@gmail.com');  
  23.    $this->email->subject('Percobaan email');  
  24.    $this->email->message('Ini adalah email percobaan ');  
  25.    if (!$this->email->send()) {  
  26.     show_error($this->email->print_debugger());  
  27.    }else{  
  28.     echo 'Success to send email';  
  29.    }  
  30.         $this->load->view('welcome_message');
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement