Advertisement
Guest User

Untitled

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