public function actionResetPassword() { $id = Yii::app()->request->getParam('id'); $key = Yii::app()->request->getParam('key'); $model = Users::model()->findByPk((int) $id); if ($model !== null && $key == ForgotPasswordForm::generateKey($model)) { $pass = ActiveRecord::randString(6); $model->password_hash = md5($pass); $model->temp_password = $pass; $model->update(); $name = $model->first_name . ' ' . $model->last_name; $login_link = '<a href="' . Yii::app()->createAbsoluteUrl("admin/site/login") . '">' . Yii::app()->createAbsoluteUrl("admin/site/login") . '</a>'; $aBody = array('{NAME}' => $name, '{PASSWORD}' => $model->temp_password, '{LINK_LOGIN}' => $login_link); if (CmsEmail::sendmail(2, array(), $aBody, $model->email)) { Yii::app()->user->setFlash("success", "An email has sent to: {$model->email}. Please check email to get new password."); } else { $model->addError('email', 'Can not send email to: ' . $model->email); } } else { Yii::log('Invalid request. Please do not repeat this request again.'); throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } $this->render('ResetPassword', array('model' => $model)); }
try { $model = ProOpportunity::GetBySlug($slug); if (is_null($model)) { throw new Exception('Invalid Request'); } $this->pageTitle = 'View Job - ' . Yii::app()->params['title']; $this->render('career/View_job', array('model' => $model)); } catch (Exception $exc) { throw new CHttpException(404, $exc->getMessage()); } } public function actionResume() { $model = new ProResume(); $flag = false; $this->pageTitle = 'Submit Resume - ' . Yii::app()->params['title']; if (isset($_POST['ProResume'])) { $model->attributes = $_POST['ProResume']; $model->file_resume = CUploadedFile::getInstance($model, 'file_resume'); $model->validate(); if (!$model->hasErrors()) { if ($model->save()) { //file_resule if (!is_null($model->file_resume)) { ProResume::save_upload_file_resume($model); } $flag = true; Yii::app()->user->setFlash('success', "Your Resume has been uploaded!"); //gui mail
public function sendMailToAdmin($engage) { try { $mUser = Users::model()->findByPk(Yii::app()->user->id); $aBody = array('{PROPERTY_NAME}' => $this->getPropertyDetail($engage->transaction_id), '{NAME}' => $mUser->title . ' ' . $mUser->first_name . ' ' . $mUser->last_name, '{REMARK}' => $engage->remark, '{PRICE}' => $engage->price, '{NRIC}' => $mUser->nric_passportno_roc); CmsEmail::sendmail(MAIL_LANDLORD_SEND_ENGAGE_US, $aBody, $aBody, Yii::app()->params['adminEmail']); } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
</strong></p> <ul> <?php foreach ($group['childs'] as $item) { ?>
/** * @param $model * @return bool * <Jason> * <*****@*****.**> */ public static function sendMailAfterRegister($model) { $url_login = Yii::app()->createAbsoluteUrl('site/login', array('role' => ROLE_REGISTER_MEMBER, 'verify_code' => $model->verify_code)); $url_login = "******"; $aBody = array('{EMAIL}' => $model->email, '{FULL_NAME}' => $model->title . ' ' . $model->first_name . ' ' . $model->last_name, '{PASSWORD}' => $model->temp_password, '{LINK}' => $url_login); if (CmsEmail::sendmail(MAIL_AFTER_REGISTER, array(), $aBody, $model->email)) { // Send a email to admin return true; } else { $model->addError('email', 'Can not send email'); } }