Clean up header MIME generation.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Dec 2008 20:19:16 +0000 (13:19 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Dec 2008 20:19:16 +0000 (13:19 -0700)
Further reading of RFC 2045 indicates that MIME-Version is NOT needed
for message/rfc822 parts - the MIME-Version string only needs to appear
in the embedded header.

framework/Mime/lib/Horde/Mime/Part.php

index 9a22b94..d6061f9 100644 (file)
@@ -740,9 +740,6 @@ class Horde_Mime_Part
             $headers = new Horde_Mime_Headers();
         }
 
-        $ptype = $this->getPrimaryType();
-        $stype = $this->getSubType();
-
         /* Get the Content-Type itself. */
         $headers->replaceHeader('Content-Type', $this->getType(), array('params' => $this->getAllContentTypeParameters()));
 
@@ -751,18 +748,13 @@ class Horde_Mime_Part
             $headers->replaceHeader('Content-Description', $descrip);
         }
 
-        /* RFC 2045 [4] - message/rfc822 and message/partial require the
-         * MIME-Version header only if they themselves claim to be MIME
-         * compliant.
-         * @TODO - Check for "MIME-Version" in message/rfc822 part.
-         * Per RFC 2046 [4], this MUST appear in the base message headers. */
-        if ($this->_basepart ||
-            (($ptype == 'message') &&
-             (($stype == 'rfc822') || ($stype == 'partial')))) {
+        /* Per RFC 2046 [4], this MUST appear in the base message headers. */
+        if ($this->_basepart) {
             $headers->replaceHeader('MIME-Version', '1.0');
         }
 
         /* message/* parts require no additional header information. */
+        $ptype = $this->getPrimaryType();
         if ($ptype == 'message') {
             return $headers;
         }