From 067fc1d3d67bc53c0d799f66b1e3d9224431db31 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Fri, 15 Apr 2016 07:06:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=8D=D0=BA=D1=81=D0=B5=D0=BF=D1=88=D0=B5=D0=BD=20=D0=B2=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=20=D1=83=D1=82=D1=81=D1=83?= =?UTF-8?q?=D1=82=D1=81=D1=82=D0=B2=D0=B8=D1=8F=20=D0=BC=D1=8B=D0=BB=D0=B0?= =?UTF-8?q?.=20=D0=97.=D0=AB.=20=D0=A2=D1=83=D0=B4=D0=B0=20=D0=B1=D1=8B=20?= =?UTF-8?q?di=20=D0=B2=20=D1=82=D0=BE=D1=82=20=D0=BA=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=81...=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/models/RegistrationForm.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/models/RegistrationForm.php b/api/models/RegistrationForm.php index f981075..2be6e1e 100644 --- a/api/models/RegistrationForm.php +++ b/api/models/RegistrationForm.php @@ -9,6 +9,7 @@ use common\models\EmailActivation; use Ramsey\Uuid\Uuid; use Yii; use yii\base\ErrorException; +use yii\base\InvalidConfigException; class RegistrationForm extends ApiForm { @@ -101,6 +102,12 @@ class RegistrationForm extends ApiForm { public function sendMail(EmailActivation $emailActivation, Account $account) { /** @var \yii\swiftmailer\Mailer $mailer */ $mailer = Yii::$app->mailer; + $fromEmail = Yii::$app->params['fromEmail']; + + if (!$fromEmail) { + throw new InvalidConfigException('Please specify fromEmail app in app params'); + } + /** @var \yii\swiftmailer\Message $message */ $message = $mailer->compose([ 'html' => '@app/mails/registration-confirmation-html', @@ -109,7 +116,7 @@ class RegistrationForm extends ApiForm { 'key' => $emailActivation->key, ]) ->setTo([$account->email => $account->username]) - ->setFrom([Yii::$app->params['fromEmail'] => 'Ely.by Accounts']) + ->setFrom([$fromEmail => 'Ely.by Accounts']) ->setSubject('Ely.by Account registration'); if (!$message->send()) {