new-support.webeffector.ru/common/helpers/MailHelper.php

27 lines
555 B
PHP
Raw Permalink Normal View History

2024-07-04 06:42:20 +03:00
<?php
namespace common\helpers;
use Yii;
class MailHelper
{
static public function sendMail($emailTo, $emailFrom, $subject, $body, $view = null): bool
{
if (!$emailFrom) {
$emailFrom = [Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']];
}
return Yii::$app
->mailer
->compose(
$view,
$body
)
->setFrom($emailFrom)
->setTo($emailTo)
->setSubject($subject)
->send();
}
}