[cvs] [Wiki] changed: Doc/Dev/MIMEPackage

Jan Schneider jan at horde.org
Wed Mar 19 13:26:41 UTC 2008


jan  Wed, 19 Mar 2008 09:26:41 -0400

Modified page: http://wiki.horde.org/Doc/Dev/MIMEPackage
New Revision:  3.10
Change log:  How to find the HTML body

@@ -116,8 +116,25 @@
 <code type="php">
 require_once 'Horde/MIME/Contents.php';
 $contents = new MIME_Contents($message);
 $body_id = $contents->findBody();
+if ($body_id) {
+    $part = &$contents->getMIMEPart($body_id);
+    $body = $part->transferDecode();
+} else {
+    $body = 'Could not render body of message.';
+}
+</code>
+
+To retrieve the HTML body text if any exists:
+
+<code type="php">
+require_once 'Horde/MIME/Contents.php';
+$contents = new MIME_Contents($message);
+$body_id = $contents->findBody('html');
+if (is_null($body_id)) {
+    $body_id = $contents->findBody();
+}
 if ($body_id) {
     $part = &$contents->getMIMEPart($body_id);
     $body = $part->transferDecode();
 } else {


More information about the cvs mailing list