SHOW:
|
|
- or go back to the newest paste.
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 | - | // var_dump($this->request->data); |
18 | + | |
19 | ||
20 | if ($this->Post->save($this->request->data)) { | |
21 | ||
22 | - | // |
22 | + | App::uses('CakeEmail', 'Network/Email'); |
23 | - | // App::uses('CakeEmail', 'Network/Email'); |
23 | + | $Email = new CakeEmail(); |
24 | - | // $Email = new CakeEmail(); |
24 | + | $Email->from(array($this->request->data['Post']['email'] => $this->request->data['Post']['name'])); |
25 | - | // $Email->from(array($this->request->data['Post']['email'] => $this->request->data['Post']['name'])); |
25 | + | $Email->to('[email protected]'); |
26 | - | // $Email->to('[email protected]'); |
26 | + | $Email->subject($this->request->data['Post']['subject']); |
27 | - | // $Email->subject($this->request->data['Post']['subject']); |
27 | + | $Email->send($this->request->data['Post']['message']); |
28 | - | //// var_dump($Email->subject()); |
28 | + | $this->Session->setFlash('Email sent.'); |
29 | - | //// exit(); |
29 | + | |
30 | - | // $Email->send($this->request->data['Post']['message']); |
30 | + | |
31 | - | // |
31 | + | |
32 | - | // |
32 | + | |
33 | - | // $this->Session->setFlash('Email sent.'); |
33 | + |