protected function emailErr(Event $error)
    {
        $dateTimeFmt = 'Y-m-d H:i:s (T)';
        $errMsg = $error['message'];
        if ($error['isHtml']) {
            $errMsg = \strip_tags($errMsg);
            $errMsg = \htmlspecialchars_decode($errMsg);
        }
        $countSince = $error['stats']['countSince'];
        $isCli = $this->isCli();
        $subject = $isCli
            ? 'Error: '.\implode(' ', $_SERVER['argv'])
            : 'Website Error: '.$_SERVER['SERVER_NAME'];
        $subject .= ': '.$errMsg.($countSince ? ' ('.$countSince.'x)' : '');
        $emailBody = '';
        if (!empty($countSince)) {
            $dateTimePrev = \date($dateTimeFmt, $error['stats']['tsEmailed']);
            $emailBody .= 'Error has occurred '.$countSince.' times since last email ('.$dateTimePrev.').'."\n\n";
        }
        $emailBody .= ''
            .'datetime: '.\date($dateTimeFmt)."\n"
            .'errormsg: '.$errMsg."\n"
            .'errortype: '.$error['type'].' ('.$error['typeStr'].')'."\n"
            .'file: '.$error['file']."\n"
            .'line: '.$error['line']."\n"
            .'';
        if (!$isCli) {
            $emailBody .= ''
                .'remote_addr: '.$_SERVER['REMOTE_ADDR']."\n"
                .'http_host: '.$_SERVER['HTTP_HOST']."\n"
                .'referer: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'null')."\n"
                .'request_uri: '.$_SERVER['REQUEST_URI']."\n"
                .'';
        }
        if (!empty($_POST)) {
            $emailBody .= 'post params: '.\var_export($_POST, true)."\n";
        }
        if ($error['type'] & $this->cfg['emailTraceMask']) {
            $backtraceStr = $this->backtraceStr($error);
            $emailBody .= "\n".($backtraceStr
                ? 'backtrace: '.$backtraceStr
                : 'no backtrace');
        }
        $this->email($this->cfg['emailTo'], $subject, $emailBody);
        return;
    }