[+] добавлен метод отправки писем
This commit is contained in:
1 parent
826941f500
commit
742aa792f9
1 file changed
+26
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
use Composer\Util\RemoteFilesystem;
|
use Composer\Util\RemoteFilesystem;
|
||||||
use Core\CoreException;
|
use Core\CoreException;
|
||||||
|
use Core\Helpers\Mail;
|
||||||
use Core\Models\DB;
|
use Core\Models\DB;
|
||||||
use Core\Models\File;
|
use Core\Models\File;
|
||||||
use Core\Models\MQ;
|
use Core\Models\MQ;
|
||||||
@@ -216,5 +217,30 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Отправка писем
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws CoreException
|
||||||
|
* @throws \JsonException
|
||||||
|
*/
|
||||||
|
public function sendMail(): void
|
||||||
|
{
|
||||||
|
$mailObject = new Mail();
|
||||||
|
$mailTo = $this->request->getProperty('to');
|
||||||
|
$mailSubject = $this->request->getProperty('subject');
|
||||||
|
$mailBody = $this->request->getProperty('body');
|
||||||
|
$mailTemplate = $this->request->getProperty('template');
|
||||||
|
$mailFrom = 'noreply@it-stories.ru';
|
||||||
|
$result = $mailObject->setTo($mailTo, 'user')
|
||||||
|
->setFrom($mailFrom, 'Info System')
|
||||||
|
->setTemplate($mailTemplate ?: MAIL_TEMPLATE_DEFAULT)
|
||||||
|
->setTemplateVars(['TITLE' => $mailSubject])
|
||||||
|
->setSubject($mailSubject)
|
||||||
|
->setBody($mailBody)
|
||||||
|
->send();
|
||||||
|
ApiView::output(['result' => $result]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user