示例#1
0
 /**
  */
 public function send($id)
 {
     $query = Email::findOne($id);
     //var_dump($query->email);
     //var_dump($this->subject);$query = Email::findOne($id);
     //var_dump($this->body);
     //exit();
     return Yii::$app->mailer->compose()->setTo($query->email)->setFrom(Yii::$app->params['adminEmail'])->setSubject($this->subject)->setTextBody($this->body)->send();
 }
示例#2
0
 public function changeStatus()
 {
     $query = Email::findOne($this->id);
     if ($query->status == 0) {
         return 'Не отправлялось';
     } elseif ($query->status == 1) {
         return 'Отправлено';
     } else {
         return 'Ошибка отправки';
     }
 }
 public function actionBackemail($emailId, $userId)
 {
     $user = $_POST['workerlist'];
     //退回给分发人员
     if ($user == NULL) {
         //关系表中删除
         $email_user = new Email_user_rs();
         $email_user = Email_user_rs::find()->where(['email_id' => $emailId, 'user_id' => $userId])->one();
         $email_user->delete();
         //Email表中修改分发状态
         $email = new Email();
         $email = Email::findOne($emailId);
         $email->handle_status = 0;
         $email->is_back = 1;
         $email->save();
     } else {
         $new_user = Users::find()->where(['username' => $user])->asArray()->one();
         $email_user = new Email_user_rs();
         $email_user = Email_user_rs::find()->where(['email_id' => $emailId, 'user_id' => $userId])->one();
         $email_user->user_id = $new_user['id'];
         $email_user->handle_status = 0;
         $email_user->save();
     }
     return SiteController::actionLogin();
 }
示例#4
0
 /**
  * Finds the Email model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Email the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Email::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }