account; $result = new self(); $result->username = $account->username; $result->email = $account->email; $result->code = $confirmation->key; $result->link = Yii::$app->request->getHostInfo() . '/activation/' . $confirmation->key; $result->locale = $account->lang; return $result; } public function getTtr(): int { return 30; } public function canRetry($attempt, $error): bool { return true; } /** * @param \yii\queue\Queue $queue * @throws \common\emails\exceptions\CannotSendEmailException */ public function execute($queue) { Yii::$app->statsd->inc('queue.sendRegistrationEmail.attempt'); $template = new RegistrationEmail(Yii::$app->mailer, Yii::$app->emailsRenderer); $template->setLocale($this->locale); $template->setParams(new RegistrationEmailParams($this->username, $this->code, $this->link)); $template->send(EmailHelper::buildTo($this->username, $this->email)); } }