Advertisement
Guest User

Untitled

a guest
Feb 16th, 2018
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Email extends CI_Controller {
  3. public function send()
  4. {
  5. $config = Array(
  6. 'protocol' => 'smtp',
  7. 'smtp_host' => 'ssl://smtp.googlemail.com',
  8. 'smtp_port' => 465,
  9. 'smtp_user' => 'email_kamu@gmail.com',
  10. 'smtp_pass' => 'password_email_kamu',
  11. 'mailtype' => 'html',
  12. 'charset' => 'iso-8859-1'
  13. );
  14. $this->load->library('email', $config);
  15. $this->email->set_newline("\r\n");
  16. $this->email->from('recodeku@gmail.com', 'Admin Re:Code');
  17. $this->email->to('email_kamu@gmail.com');
  18. $this->email->subject('Percobaan email');
  19. $this->email->message('Ini adalah email percobaan untuk Tutorial CodeIgniter: Mengirim Email via Gmail SMTP menggunakan Email Library CodeIgniter @ recodeku.blogspot.com');
  20.  
  21.  
  22. if (!$this->email->send()) {
  23. show_error($this->email->print_debugger());
  24. }else{
  25. echo 'Success to send email';
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement