public static function formatText($txt = '', $type = 'plain', $spaces = false)
    {
        switch ($type) {
            case 'ascii' :
                $_txt = '';
                if ($spaces==true) {
                    $txt = str_replace(' ', '_', $txt);
                }
                for ($i=0; $i<strlen($txt);$i++) {
                    $_txt .= self::charAscii($txt[$i]);
                }
                $txt = $_txt;
                break;
            default : break;
        }

        $mailer = Mailer::getInstance();
        $limit = $mailer->getOption('wordwrap_limit');
        $formated='';
        foreach (explode("\n", $txt) as $_line) {
            $_line = trim($_line);
            if (strlen($_line)>$limit) {
                $_line = wordwrap($_line, $limit, Mailer::$LINE_ENDING);
            }
            if (strlen($_line)) {
                $formated .= $_line.Mailer::$LINE_ENDING;
            }
        }
        return $formated;
    }