'Champs obligatoire'], ['email', 'email', 'message' => 'Email incorrect'], ['isTest', 'string'], ['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification', 'when' => function($model) { return $model->isTest != 'isTest'; }], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'name' => 'Nom', 'email' => 'Email', 'subject' => 'Sujet', 'body' => 'Message', 'verifyCode' => 'Code de vérification', ]; } /** * Sends an email to the specified email address using the information collected by this model. * * @param string $email the target email address * @return boolean whether the email was sent */ public function sendEmail(Producer $producer) { return Yii::$app->mailerService->sendProducer( $producer, 'Contact : ' . $this->subject, 'contact', [ 'content' => $this->body, 'name' => $this->name, 'email' => $this->email ], $this->email ); } public function sendEmailShopSupport(Producer $producer) { return Yii::$app->mailerService->sendAdmin( 'Support > '.$producer->name.' : ' . $this->subject, 'contact', [ 'content' => $this->body, 'name' => $this->name, 'email' => $this->email ], $this->email ); } public function sendEmailAdmin() { return Yii::$app->mailerService->sendAdmin( 'Contact : ' . $this->subject, 'contact', [ 'content' => $this->body, 'name' => $this->name, 'email' => $this->email ], $this->email ); } }