Интеграция письма о регистрации

This commit is contained in:
ErickSkrauch 2016-09-13 14:50:22 +03:00
parent aeeef828e8
commit 9d935d84cd
2 changed files with 17 additions and 6 deletions

View File

@ -11,6 +11,7 @@ use common\models\confirmations\RegistrationConfirmation;
use common\models\EmailActivation;
use common\validators\LanguageValidator;
use common\validators\PasswordValidate;
use Ely\Email\Renderer;
use Exception;
use Ramsey\Uuid\Uuid;
use Yii;
@ -131,13 +132,18 @@ class RegistrationForm extends ApiForm {
throw new InvalidConfigException('Please specify fromEmail app in app params');
}
/** @var \yii\swiftmailer\Message $message */
$message = $mailer->compose([
'html' => '@app/mails/registration-confirmation-html',
'text' => '@app/mails/registration-confirmation-text',
], [
$htmlBody = (new Renderer())->getTemplate('register')
->setLocale($account->lang)
->setParams([
'username' => $account->username,
'key' => $emailActivation->key,
'link' => Yii::$app->request->getHostInfo() . '/activation/' . $emailActivation->key,
])
->render();
/** @var \yii\swiftmailer\Message $message */
$message = $mailer->compose()
->setHtmlBody($htmlBody)
->setTo([$account->email => $account->username])
->setFrom([$fromEmail => 'Ely.by Accounts'])
->setSubject('Ely.by Account registration');

View File

@ -24,7 +24,8 @@
"php-amqplib/php-amqplib": "^2.6.2",
"ely/yii2-tempmail-validator": "~1.0.0",
"emarref/jwt": "~1.0.3",
"ely/amqp-controller": "^0.1.0"
"ely/amqp-controller": "^0.1.0",
"ely/email-renderer": "dev-master#10e77d7a60403e87ca6e8c7d9e62a36fc5e08565"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
@ -48,6 +49,10 @@
{
"type": "git",
"url": "git@gitlab.com:elyby/amqp-controller.git"
},
{
"type": "git",
"url": "git@gitlab.com:elyby/email-renderer.git"
}
],
"scripts": {