public function _getXML($input, $indent = 1) { $htab = "\t"; $crlf = "\r\n"; $output = ""; $headers = (array) $input->headers; foreach ($headers as $hdr_name => $hdr_value) { if (is_array($headers[$hdr_name])) { for ($i = 0; $i < count($hdr_value); $i++) { $output .= Mail_mimeDecode::_getxml_helper($hdr_name, $hdr_value[$i], $indent); } } else { $output .= Mail_mimeDecode::_getxml_helper($hdr_name, $hdr_value, $indent); } } if (!empty($input->parts)) { for ($i = 0; $i < count($input->parts); $i++) { $output .= $crlf . str_repeat($htab, $indent) . "<mimepart>" . $crlf . Mail_mimeDecode::_getxml($input->parts[$i], $indent + 1) . str_repeat($htab, $indent) . "</mimepart>" . $crlf; } } else { if (isset($input->body)) { $output .= $crlf . str_repeat($htab, $indent) . "<body><![CDATA[" . $input->body . "]]></body>" . $crlf; } } return $output; }