Skip to content
This repository has been archived by the owner on May 28, 2020. It is now read-only.

Commit

Permalink
Issue #22
Browse files Browse the repository at this point in the history
Added contact for function using cake builtin email process.

Signed-off-by: Peter Brenner <[email protected]>
  • Loading branch information
pbrenner committed Feb 21, 2013
1 parent 0cae84b commit 2e2aaed
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/Controller/ConstituenciesController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
/**
* Constituencies Controller
*
Expand Down Expand Up @@ -126,4 +127,26 @@ public function loadLogo($id = null) {
}
$this->set('constituency', $this->Constituency->read(null, $id));
}

public function contact () {

//$adminEmail = Configure::read('contactEmail');
$adminEmail = '[email protected]';

if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
} else {
$contactData = $this->request->data;

$email = new CakeEmail();
$email->viewVars(array('subject' => $contactData['university'], 'msg' => $contactData['message']));
$email->to($adminEmail)
->subject($contactData['university'])
->from($contactData['email'])
->send($contactData['message']);


}
return;
}
}

0 comments on commit 2e2aaed

Please sign in to comment.