src/MailerHelper.php
public static function mailSend(array $addresses, string $subject, string $message, array $files = []): bool
    {
        $mail = new PHPMailer();

        //$mail->SMTPDebug = 4;

        $reflector = new \ReflectionClass(PHPMailer::class);
        $mailerDir = \dirname($reflector->getFileName());

        $mail->setLanguage(
            static::getSetting('MAIL_LANG'),
            "$mailerDir/language/phpmailer.lang-" . static::getSetting('MAIL_LANG') . '.php'
        );
        $mail->CharSet = static::getSetting('MAIL_CHARSET');
        $mail->isSMTP();
        $mail->Host = static::getSetting('MAIL_HOST');
        $mail->SMTPAuth = true;
        $mail->Username = static::getSetting('MAIL_USERNAME');
        $mail->Password = static::getSetting('MAIL_PASSWORD');
        $mail->SMTPSecure = static::getSetting('MAIL_SMTPSECURE');
        $mail->Port = static::getSetting('MAIL_PORT');

        $mail->From = static::getSetting('MAIL_FROM');
        $mail->FromName = static::getSetting('MAIL_FROM_NAME');

        foreach ($addresses as &$value) {
            $mail->addAddress($value);
        }

        unset($value);

        $mail->addReplyTo(static::getSetting('MAIL_REPLYTO_ADDRESS'), static::getSetting('MAIL_REPLYTO_NAME'));

        $mail->WordWrap = 50;

        foreach ($files as $file) {
            $mail->addAttachment($file);
        }

        $mail->isHTML();
        $mail->Subject = $subject;
        $mail->Body = $message;

        if (!$mail->send()) {
            return false;
        }

        return true;
    }
public static function mailSend(array $addresses, string $subject, string $message, array $files = []): bool
    {
        $mail = new PHPMailer();

        //$mail->SMTPDebug = 4;

        $reflector = new \ReflectionClass(PHPMailer::class);
        $mailerDir = \dirname($reflector->getFileName());

        $mail->setLanguage(
            static::getSetting('MAIL_LANG'),
            "$mailerDir/language/phpmailer.lang-" . static::getSetting('MAIL_LANG') . '.php'
        );
        $mail->CharSet = static::getSetting('MAIL_CHARSET');
        $mail->isSMTP();
        $mail->Host = static::getSetting('MAIL_HOST');
        $mail->SMTPAuth = true;
        $mail->Username = static::getSetting('MAIL_USERNAME');
        $mail->Password = static::getSetting('MAIL_PASSWORD');
        $mail->SMTPSecure = static::getSetting('MAIL_SMTPSECURE');
        $mail->Port = static::getSetting('MAIL_PORT');

        $mail->From = static::getSetting('MAIL_FROM');
        $mail->FromName = static::getSetting('MAIL_FROM_NAME');

        foreach ($addresses as &$value) {
            $mail->addAddress($value);
        }

        unset($value);

        $mail->addReplyTo(static::getSetting('MAIL_REPLYTO_ADDRESS'), static::getSetting('MAIL_REPLYTO_NAME'));

        $mail->WordWrap = 50;

        foreach ($files as $file) {
            $mail->addAttachment($file);
        }

        $mail->isHTML();
        $mail->Subject = $subject;
        $mail->Body = $message;

        if (!$mail->send()) {
            return false;
        }

        return true;
    }
Отправка почты

@param array $addresses - массив адресов под рассылку
@param string $subject - тема письма
@param string $message - тело письма
@param array $files - прикрепляемые файлы

@return bool

@throws \PHPMailer\PHPMailer\Exception
@throws \ReflectionException