Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. function sending_mail(){
  3. $mail_config = Array (
  4. 'mailtype' =>'html',
  5. 'protocol' => 'smtp',
  6. 'smtp_host' => 'ssl://smtp.gmail.com',
  7. 'smtp_port' => 465,
  8. 'smtp_user' => 'myemail@gmail.com',
  9. 'smtp_pass' => 'mypassword',
  10. 'charset' => 'iso-8859-1'
  11. );
  12. $this->load->library('email',$mail_config);
  13. $this->email->set_newline("rn");
  14. $this->email->from('myemail@gmail.com', 'InnoLogiq LLP');
  15. $this->email->to('receipientemail@gmail.com');
  16. $message = 'mymessage';
  17. $this->email->subject("mysubject");
  18. $this->email->message($message);
  19. if($this->email->send()){
  20. $data['flag']="success" ;
  21. $data['msg']="Email sent";
  22. $this->load->view('templates/header1');
  23. $this->load->view('company/contact_us',$data);
  24. $this->load->view('templates/footer');
  25. }
  26. else{
  27. $data['msg']="Here I want mesage but its showing error, due to net connection";
  28. $data['flag']='error';
  29. print_r("Sorry! mail not send");
  30. $this->load->view('company/contact_us',$data);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement