public function actionSuscriptorForm()
 {
     $model = new app\modules\suscriptor\models\Suscripciones();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             // form inputs are valid, do something here
             return;
         }
     }
     return $this->render('site/suscriptorForm', ['model' => $model]);
 }
 /**
  * Creates a new Suscripciones model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionSuscribe()
 {
     $model = new Suscripciones();
     if ($model->load(Yii::$app->request->post())) {
         $result = Suscripciones::find()->where(['mail' => $model->mail])->one();
         if ($result == null) {
             $model->codigo = md5($model->mail);
             if ($model->save()) {
                 $arr = ['id' => $model->id, 'key' => $model->mail];
                 $msg = $this->buildSuscriptionMailContent($arr);
                 $this->sendMail($model->mail, 'Suscripcion a Radioalbum', $msg);
                 return $this->renderAjax('create', ['model' => $model, 'response' => 'success']);
             }
         } else {
             return $this->renderAjax('create', ['model' => $model, 'response' => 'exist']);
         }
     } else {
         return $this->renderAjax('create', ['model' => $model, 'response' => 'create']);
     }
 }