private function _encodeHeader($val)
    {
        if (is_array($val)) {
            return join(', ', array_map(array($this, '_encodeHeader'), $val));
        }
        // if name matched encode Base64
        if (preg_match("/(.*)<(.*)>/", $val, $match)) {
            return '=?' . $this->_charset . '?B?' . base64_encode($match[1]) . '?= <' . $match[2] . '>';
        }
        return $val;
    }