mail bugfix

This commit is contained in:
Martin Müller 2014-04-13 13:28:39 +02:00
parent ca42efc55f
commit bba96e8c84
6 changed files with 50 additions and 32 deletions

View File

@ -22,23 +22,7 @@ class JobController extends AppController {
*/
public static function sendApplicationMail($mail,$id){
$Email = new CakeEmail('dreamjobMain');
$Email->to($mail);
$Email->subject('Welcome to our really cool thing');
$Email->template('job_application');
$Email->viewVars(array('app_id'=>$id));
return $Email->send();
}
public static function sendMsgMail($mail,$id){
$Email = new CakeEmail('dreamjobMain');
$Email->to($mail);
$Email->subject('Welcome to our really cool thing');
$Email->template('job_application_msg');
$Email->viewVars(array('app_id'=>$id));
return $Email->send();
}
public function openingList() {
$this->MiconwareSession->init($this);

View File

@ -10,18 +10,9 @@ class RegistrationController extends AppController {
*
* @var array
*/
public $componens = array('Email','MiconwareSession');
public $componens = array('MiconwareSession');
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User');
public static function registrationMail($data){
$Email = new CakeEmail('dreamjobMain');
$Email->to($data['User']['mail']);
$Email->subject('Welcome to our really cool thing');
$Email->template('registration');
$key = substr($data['User']['code'],2);
$Email->viewVars(array('data'=>$data,'key'=>$key));
return $Email->send();
}
public function main() {
$this->MiconwareSession->init($this);

View File

@ -1,5 +1,6 @@
<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/**
* DreamjobCompany Model
*
@ -38,6 +39,16 @@ class DreamjobCompany extends AppModel {
public $displayField = 'djaccount_ptr_id';
public static function sendMail($data){
$Email = new CakeEmail('dreamjobMain');
$Email->to($data['User']['mail']);
$Email->subject('Welcome to our really cool thing');
$Email->template('registration');
$key = substr($data['User']['code'],2);
$Email->viewVars(array('data'=>$data,'key'=>$key));
return $Email->send();
}
public function registration($data){
$dataSource = $this->getDataSource();
@ -73,7 +84,7 @@ class DreamjobCompany extends AppModel {
$result=$this->save();
}
if($result)
$result = RegistrationController::registrationMail($data);
$result = self::sendMail($data);
if ($result) {
$dataSource->commit();
return true;

View File

@ -1,5 +1,6 @@
<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/**
* MicDjJobsApplication Model
*
@ -34,6 +35,15 @@ class DreamjobJobApplication extends AppModel {
*
* @var array
*/
public static function sendMail($mail,$id){
$Email = new CakeEmail('dreamjobMain');
$Email->to($mail);
$Email->subject('Welcome to our really cool thing');
$Email->template('job_application');
$Email->viewVars(array('app_id'=>$id));
return $Email->send();
}
public function sendApplication($data){
$dataSource = $this->getDataSource();
$dataSource->begin();
@ -41,7 +51,7 @@ class DreamjobJobApplication extends AppModel {
if($result){
$open = $this->DreamjobJobOpening->find('first', array('conditions' => array('DreamjobJobOpening.id' => $data['DreamjobJobApplication']['opening_id'])));
$result = JobController::sendApplicationMail($open['User']['mail']l,$this->id);
$result = self::sendMail($open['User']['mail']l,$this->id);
}
if ($result) {

View File

@ -1,5 +1,6 @@
<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/**
* MicDjJobsMsg Model
*
@ -33,6 +34,14 @@ class DreamjobJobMsg extends AppModel {
*
* @var array
*/
public static function sendMail($mail,$id){
$Email = new CakeEmail('dreamjobMain');
$Email->to($mail);
$Email->subject('Welcome to our really cool thing');
$Email->template('job_application_msg');
$Email->viewVars(array('app_id'=>$id));
return $Email->send();
}
public function sendMessage(){
$dataSource = $this->getDataSource();
$dataSource->begin();
@ -40,9 +49,9 @@ class DreamjobJobMsg extends AppModel {
if($result){
$app = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->application_id)));
if($this->fromcompany)
$result = JobController::sendMsgMail($app['User']['mail'],$this->application_id);
$result = self::sendMail($app['User']['mail'],$this->application_id);
else
$result = JobController::sendMsgMail($app['WorkerUser']['mail'],$this->application_id);
$result = sel::sendMail($app['WorkerUser']['mail'],$this->application_id);
}
if ($result) {
$dataSource->commit();

View File

@ -1,5 +1,6 @@
<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/**
* DreamjobWorker Model
*
@ -38,6 +39,18 @@ class DreamjobWorker extends AppModel {
*/
public $displayField = 'djaccount_ptr_id';
public static function sendMail($data){
$Email = new CakeEmail('dreamjobMain');
$Email->to($data['User']['mail']);
$Email->subject('Welcome to our really cool thing');
$Email->template('registration');
$key = substr($data['User']['code'],2);
$Email->viewVars(array('data'=>$data,'key'=>$key));
return $Email->send();
}
public function registration($data){
$dataSource = $this->getDataSource();
@ -87,7 +100,7 @@ class DreamjobWorker extends AppModel {
$result=$this->save();
}
if($result)
$result = RegistrationController::registrationMail($data);
$result = self::sendMail($data);
if ($result) {
$dataSource->commit();