public static function pushEmail($name, $to, array $params = [], $fromName = null, $replyTo = null, $subject = null, $sendAfter = null, array $attachments = [])
    {
        //brak definicji
        if (null === ($def = Orm\CmsMailDefinitionQuery::langByName($name)
            ->findFirst())) {
            return false;
        }
        //walidacja listy adresów "do"
        $email = new \Mmi\Validator\EmailAddressList;
        if (!$email->isValid($to)) {
            return false;
        }
        //nowy rekord maila
        $mail = new Orm\CmsMailRecord;
        $mail->cmsMailDefinitionId = $def->id;
        $mail->to = $to;
        $mail->fromName = $fromName ? $fromName : $def->fromName;
        $mail->replyTo = $replyTo ? $replyTo : $def->replyTo;
        $mail->subject = $subject ? $subject : $def->subject;
        $mail->dateSendAfter = $sendAfter ? $sendAfter : date('Y-m-d H:i:s');
        $files = [];
        //załączniki
        foreach ($attachments as $fileName => $filePath) {
            if (!file_exists($filePath)) {
                continue;
            }
            $files[$fileName] = ($filePath);
        }
        //serializacja załączników
        $mail->attachements = serialize($files);
        //przepychanie zmiennych do widoku
        $view = \Mmi\App\FrontController::getInstance()->getView();
        foreach ($params as $key => $value) {
            $view->$key = $value;
        }
        //rendering wiadomości
        $mail->message = $view->renderDirectly($def->message);
        //rendering tematu
        $mail->subject = $view->renderDirectly($mail->subject);
        $mail->dateAdd = date('Y-m-d H:i:s');
        //zapis maila
        return $mail->save();
    }