Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. class Email extends CI_Controller
  2. {
  3. function __construct()
  4. {
  5. parent:: CI_Controller();
  6. }
  7.  
  8. function index() {
  9. $config = Array(
  10. 'protocol' =>'smtp',
  11. 'smtp_host' => 'ssl://smtp.googlemail.com',
  12. 'smtp_port' => 465,
  13. 'smtp_user' => 'nikoletta.fytampani@gmail.com',
  14. 'smtp_pass' => 'lettabozika86'
  15. );
  16.  
  17. // dik mou $config= $this->load->config->email($config);
  18.  
  19. $this->load->library('email',$config);
  20. $this->email->set_newline("\r\n");
  21.  
  22. $this->email->from('nikoletta.fytampani@gmail.com','Zetta');
  23. $this->email->to('nikoletta.fytampani@gmail.com');
  24. $this->email->subject('THis is an email test');
  25. $this->email->message('its is working!!');
  26.  
  27. $path = $this->config->item('server_root');
  28. //echo $path; die();
  29. $file = $path.'/CI3/attachments/yourinfo.txt';
  30.  
  31. $this->email->attach($file);
  32.  
  33. if($this->email->send())
  34. {
  35. echo "Mail was sent";
  36.  
  37. }
  38. else
  39. {
  40. show_error($this->email->print_debugger());
  41. }
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement