|
|
@@ -8,9 +8,9 @@ class Email
|
|
|
{
|
|
|
/**
|
|
|
* @param string $email
|
|
|
- * @return bool
|
|
|
+ * @return bool|string
|
|
|
*/
|
|
|
- public static function sendAdminLoginCode(string $email): bool
|
|
|
+ public static function sendAdminLoginCode(string $email)
|
|
|
{
|
|
|
$subject = 'Elken Login Code';
|
|
|
$code = Tool::randomString(6);
|
|
|
@@ -18,12 +18,13 @@ class Email
|
|
|
|
|
|
$mailer = Yii::$app->mailer;
|
|
|
$mailer->useFileTransport = false;
|
|
|
- return $mailer->compose()
|
|
|
- ->setFrom('eshop-noreply@elken.com')
|
|
|
-// ->setFrom(Yii::$app->params['adminEmail'])
|
|
|
+ $result = $mailer->compose()
|
|
|
+ ->setFrom('eshop-noreply@elken.com')
|
|
|
->setTo($email)
|
|
|
->setSubject($subject)
|
|
|
->setHtmlBody($message)
|
|
|
->send();
|
|
|
+
|
|
|
+ return !$result ? false : $code;
|
|
|
}
|
|
|
}
|