Advertisement
addeye

controller messagesdata

May 25th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. public function reply()
  2. {
  3. $data = $this->input->post();
  4. $data['answered']=date('Y-m-d H:i:s');
  5. $id = $this->input->post('id');
  6.  
  7. $subject = $this->input->post('subject');
  8. $message = $this->input->post('answer');
  9. $emailto = $this->input->post('email');
  10.  
  11. // Get full html:
  12. $body =
  13. '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset='.strtolower(config_item('charset')).'" />
  17. <title>'.html_escape($subject).'</title>
  18. <style type="text/css">
  19. body {
  20. font-family: Arial, Verdana, Helvetica, sans-serif;
  21. font-size: 20px;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. '.$message.'
  27. </body>
  28. </html>';
  29. // Also, for getting full html you may use the following internal method:
  30. // $body = $this->email->full_html($subject, $message);
  31.  
  32. $result = $this->email
  33. ->from('hello@1man1tourist.com')
  34. ->to($emailto)
  35. ->subject($subject)
  36. ->message($body)
  37. ->send();
  38.  
  39. if($result) {
  40.  
  41. $this->messages_model->updateData($id, $data);
  42. //if process insert success
  43. $this->session->set_flashdata('message_success', "Successfully insert data and send to email");
  44. } else {
  45. //process insert failed
  46. $this->session->set_flashdata('message_danger', "Failed insert data");
  47. }
  48.  
  49. redirect('/messagesdata/');
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement