src/MimeMailer/Helper.php
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;
    }
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;
    }
Format a text with a special encoding

@param string $txt The text to format
@param string $type The type of the encoding : 'plain' or 'ascii'
@param bool $spaces Replace all spaces with underscores or not (default is FALSE)
@return string The transformed text