to($mail); $Email->bcc('service@dream-job.eu'); $Email->subject('Bestellung des Premium Pakets'); $Email->template('extra_premium'); $Email->viewVars(array('id'=>$id,'data'=>$data)); $Email->attachments(array('dak.jpg' => WWW_ROOT.DS.'mail'.DS.'dak.jpg')); return $Email->send(); } public function askPremium($data){ $dataSource = $this->getDataSource(); $dataSource->begin(); $result=$this->saveAssociated($data); if($result){ $open = $this->DreamjobCompany->find('first', array('conditions' => array('DreamjobCompany.djaccount_ptr_id' => $data['DreamjobCompanyPro']['company_id']))); $result = self::sendMail($open['User']['mail'],array('DreamjobCompany'=>$open['DreamjobCompany']),$this->id); } if ($result) { $dataSource->commit(); return true; } else { $dataSource->rollback(); } return false; } public $hasOne = array( 'DreamjobCompany' => array( 'className' => 'DreamjobCompany', 'foreignKey' => 'djaccount_ptr_id' ) ); }