Answer the question
In order to leave comments, you need to log in
How to set up sending an email about authorization in yii2 with a specific message text?
You need to configure email notification about user authorization.
Configured like this in main.php
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
[
'class' => 'yii\log\FileTarget', //в файл
'categories' => ['payment_fail'], //категория логов
'logFile' => '@runtime/logs/pay.log', //куда сохранять
'logVars' => [] //не добавлять в лог глобальные переменные ($_SERVER, $_SESSION...)
],
[
'class' => 'yii\log\EmailTarget', //шлет на e-mail
'categories' => ['payment_success'],
'mailer' => 'yii\swiftmailer\Mailer',
'logVars' => [],
'message' => [
'from' => ['[email protected]' => 'НАЗВАНИЕ САЙТА'], //от кого
'to' => ['[email protected]'], //кому
'subject' => 'Получен платеж. Лог в теле сообщения.', //тема
],
],
],
],
2019-05-16 09:29:29 [::1][-][-][info][login_true] [
'status' => 'User is logged in',
'post' => [],
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question