Advertisement
Guest User

mailfunction in croogo

a guest
Mar 11th, 2015
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <---contact.ctp--->/Vendor/croogo/croogo/Nodesview/contact.ctp
  2. <?php
  3.  
  4. echo $this->Session->flash();
  5.  
  6. echo $this->Form->create('Post');
  7. echo $this->Form->input('name',array('required'=>'required'));
  8. echo $this->Form->input('email',array('required'=>'required','type'=>'email'));
  9. echo $this->Form->input('phone',array('required'=>'required'));
  10. echo $this->Form->input('subject',array('required'=>'required'));
  11. echo $this->Form->input('message',array('required'=>'required', 'type' => 'textarea')).'<br>' ;
  12. echo $this->Form->end('SEND');
  13.  
  14. ?>
  15.  
  16. <---NodesController.php--->
  17. public function contact() {
  18. if (!empty($this->request->data)) {
  19.  
  20. if ($this->Post->save($this->request->data)) {
  21.  
  22. App::uses('CakeEmail', 'Network/Email');
  23. $Email = new CakeEmail();
  24. $Email->from(array($this->request->data['Post']['email'] => $this->request->data['Post']['name']));
  25. $Email->to('[email protected]');
  26. $Email->subject($this->request->data['Post']['subject']);
  27. $Email->send($this->request->data['Post']['message']);
  28. $this->Session->setFlash('Email sent.');
  29. $this->redirect(array('action' => 'contact'));
  30. }
  31. }
  32. $this->set('posts', $this->Post->find('all'));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement