Advertisement
Guest User

Config Email

a guest
Apr 21st, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class EmailCoba extends CI_Controller {
  5.  
  6. public function index()
  7. {
  8. $sender_email = "help.juraganrumah@gmail.com";
  9. $user_password = "ilodamnoke26";
  10. $username = "Juragan Rumah";
  11. $receiver_email = "201253077@std.umk.ac.id";
  12. $subject = "Sample";
  13. $message = "Jajalen";
  14.  
  15. $this->emailConfig();
  16. // Sender email address
  17. $this->email->from($sender_email, $username);
  18. // Receiver email address.for single email
  19. $this->email->to($receiver_email);
  20. //send multiple email
  21. // $this->email->to("abc@gmail.com,xyz@gmail.com,jkl@gmail.com");
  22. // Subject of email
  23. $this->email->subject($subject);
  24. // Message in email
  25. $this->email->message($message);
  26. // It returns boolean TRUE or FALSE based on success or failure
  27.  
  28. $mail = ($this->email->send()) ? "Sent" : "Failed" ;
  29. echo $this->email->print_debugger();
  30.  
  31. echo $mail;
  32. }
  33.  
  34. private function emailConfig()
  35. {
  36. $config = array(
  37. 'protocol' => 'smtp' ,
  38. 'smtp_host' => 'ssl://smtp.googlemail.com' ,
  39. 'smtp_port' => 465 ,
  40. 'smtp_user' => 'help.juraganrumah@gmail.com' ,
  41. 'smtp_pass' => 'ilodamnoke26',
  42. 'mailtype' => 'html',
  43. 'charset' => 'utf-8',
  44. 'newline' => "\r\n",
  45. 'wordwrap' => TRUE
  46. );
  47.  
  48. // Load email library and passing configured values to email library
  49. $this->load->library('email',$config);
  50. }
  51.  
  52. }
  53.  
  54. /* End of file EmailCoba.php */
  55. /* Location: ./application/controllers/EmailCoba.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement