Ejemplo n.º 1
0
 /**
  * Creates a new CallMeMain model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new CallMeMain();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 public function actionCallmemain($name, $tel)
 {
     $email = EmailTo::findOne(['id' => 1]);
     $model = new CallMeMain();
     $model->name = $name;
     $model->tel = $tel;
     if ($model->save()) {
         $to = $email->email_to;
         $subject = "Запрос на звонок";
         $message = '
             <html>
                 <head>
                     <title>Поступила новая заявка запроса на звонок</title>
                 </head>
                 <body>
                     <p>Только что поступила новая заявка запроса на звонок!</p>
                     <p>Имя' . $name . '</p>
                     <p>Телефон:' . $tel . '</p>
                 </body>
             </html>';
         $headers = "Content-type: text/html; charset=windows-utf-8 \r\n";
         $headers .= "From: TEST\r\n";
         $headers .= "Bcc:TEST1\r\n";
         mail($to, $subject, $message, $headers);
         return 'success';
     }
     return 'fail';
 }