Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ContactsController extends AppController {
- var $name = 'Contacts';
- var $uses = array('Client');
- public $helpers = array('Form', 'Html');
- public $components = array('Email');
- public function index(){
- if( !empty($this->data) ){
- $mensagem = @$this->Email->render($this, 'faleconosco', $this->data);
- if( @$this->Email->send("junio@lapisraro.com.br", "Formulário de contato - Araujo Foto", $mensagem ) ){
- if((int) $this->data['Contact']['wants_receive_email']) {
- $this->Client->create();
- $client = array();
- $client['Client']['name'] = $this->data['Contact']['name'];
- $client['Client']['email'] = $this->data['Contact']['email'];
- $client['Client']['remote_addr'] = env('REMOTE_ADDR');
- $client['Client']['agree_terms'] = 1;
- @$this->Client->save($client);
- }
- $this->Session->setFlash(__('Contato enviado com sucesso.<br>Obrigado pela participação.', true));
- $this->render();
- } else {
- $this->Session->setFlash(__('Houve um problema durante o envio. Tente novamente.', true));
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment