Guest User

Untitled

a guest
Mar 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. public function notify_marketing(){
  2. $config = Array(
  3. 'protocol' => 'smtp',
  4. 'smtp_host' => 'ssl://smtp.googlemail.com',
  5. 'smtp_port' => 465,
  6. 'smtp_user' => 'myvalidemail@gmail.com',
  7. 'smtp_pass' => '*******',//my valid email password
  8. 'mailtype' => 'html',
  9. 'charset' => 'iso-8859-1',
  10. 'wordwrap' => TRUE
  11. );
  12.  
  13. $this->email->initialize($config);
  14. $this->load->library('email', $config);
  15. $this->email->set_newline("rn");
  16. $this->email->from('myvalidemail@gmail.com');
  17. $this->email->to('validreceiptent@gmail.com');
  18. $this->email->subject('My Subject');
  19. $this->email->message('Hello there');
  20. if($this->email->send())
  21. {
  22. $this->session->set_flashdata("success","Email sent.");
  23. }
  24. else
  25. {
  26. show_error($this->email->print_debugger());
  27. }
  28. }
  29.  
  30. <div id="exception_error">
  31. <h1><span class="type">An Error Was Encountered [ 500 ]</span></h1>
  32. <div class="content">
  33. <p><p>220 smtp.googlemail.com ESMTP bv4sm16669443pbb.86 - gsmtp
  34. <br /><pre>hello: 250-smtp.googlemail.com at your service, [110.44.127.179]
  35. 250-SIZE 35882577
  36. 250-8BITMIME
  37. 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN XOAUTH
  38. 250-ENHANCEDSTATUSCODES
  39. 250-PIPELINING
  40. 250-CHUNKING
  41. 250 SMTPUTF8
  42. </pre>lang:email_smtp_auth_pw<br />lang:email_send_failure_smtp<br /><pre>User-Agent: CodeIgniter
  43. Date: Tue, 18 Aug 2015 12:03:42 +0545
  44. From: <********@gmail.com>
  45. Return-Path: <********@gmail.com>
  46. To: *******@gmail.com
  47. Subject: =?iso-8859-1?Q?My_Subject?=
  48. Reply-To: "********@gmail.com" <*********@gmail.com>
  49. X-Sender: *******@gmail.com
  50. X-Mailer: CodeIgniter
  51. X-Priority: 3 (Normal)
  52. Message-ID: <55d2ce42747f5@gmail.com>
  53. Mime-Version: 1.0
  54.  
  55. <?php
  56. $config['protocol'] = 'smtp';
  57. $config['smtp_host'] = 'ssl://smtp.gmail.com'; //change this
  58. $config['smtp_port'] = '465';
  59. $config['smtp_user'] = 'user@gmail.com'; //change this
  60. $config['smtp_pass'] = 'password'; //change this
  61. $config['mailtype'] = 'html';
  62. $config['charset'] = 'iso-8859-1';
  63. $config['wordwrap'] = TRUE;
  64. $config['newline'] = "rn";
  65. ?>
  66.  
  67. <?php
  68. //send mail
  69. function sendmail()
  70. {
  71. $this->load->library('email'); // load email library
  72. $this->email->from('user@gmail.com', 'sender name');
  73. $this->email->to('test1@gmail.com');
  74. $this->email->cc('test2@gmail.com');
  75. $this->email->subject('Your Subject');
  76. $this->email->message('Your Message');
  77. $this->email->attach('/path/to/file1.png'); // attach file
  78. $this->email->attach('/path/to/file2.pdf');
  79. if ($this->email->send())
  80. echo "Mail Sent!";
  81. else
  82. echo "There is error in sending mail!";
  83. }
  84. ?>
Add Comment
Please, Sign In to add comment