public function sendRecoveryMessage($user, $token)
    {
        $mailVars = [
            '{token}' => $token->url
        ];

        /**
         * @var $mailTemplate Template
         */
        $mailTemplate = \Yii::$app->get('emailTemplates')
            ->getTemplate('recovery', Language::getCurrent()->id);
        $mailTemplate->parseSubject($mailVars);
        $mailTemplate->parseBody($mailVars);

        return \Yii::$app->shopMailer->compose('mail-body', ['bodyContent' => $mailTemplate->getBody()])
            ->setFrom([\Yii::$app->shopMailer->transport->getUsername() => \Yii::$app->name ?? Url::to(['/'], true)])
            ->setTo($user->email)
            ->setSubject($mailTemplate->getSubject())
            ->send();
    }
public function sendRecoveryMessage($user, $token)
    {
        $mailVars = [
            '{token}' => $token->url
        ];

        /**
         * @var $mailTemplate Template
         */
        $mailTemplate = \Yii::$app->get('emailTemplates')
            ->getTemplate('recovery', Language::getCurrent()->id);
        $mailTemplate->parseSubject($mailVars);
        $mailTemplate->parseBody($mailVars);

        return \Yii::$app->shopMailer->compose('mail-body', ['bodyContent' => $mailTemplate->getBody()])
            ->setFrom([\Yii::$app->shopMailer->transport->getUsername() => \Yii::$app->name ?? Url::to(['/'], true)])
            ->setTo($user->email)
            ->setSubject($mailTemplate->getSubject())
            ->send();
    }
public function sendRecoveryMessage ( $ user , $ token ) { $ mailVars = [ '{token}' => $ token -> url ] ; /**
         * @var $mailTemplate Template
         */ $ mailTemplate = \ Yii :: $ app -> get ( 'emailTemplates' ) -> getTemplate ( 'recovery' , Language :: getCurrent ( ) -> id ) ; $ mailTemplate -> parseSubject ( $ mailVars ) ; $ mailTemplate -> parseBody ( $ mailVars ) ; return \ Yii :: $ app -> shopMailer -> compose ( 'mail-body' , [ 'bodyContent' => $ mailTemplate -> getBody ( ) ] ) -> setFrom ( [ \ Yii :: $ app -> shopMailer -> transport -> getUsername ( ) => \ Yii :: $ app -> name ?? Url :: to ( [ '/' ] , true ) ] ) -> setTo ( $ user -> email ) -> setSubject ( $ mailTemplate -> getSubject ( ) ) -> send ( ) ; }
Sends an email to a user with recovery link.

@param User  $user
@param Token $token

@return bool
Sends an email to a user with recovery link .