[imp] MIME Attachment viewing patch...
Tim Meader
tmeader at cne-odin.gsfc.nasa.gov
Thu Jun 26 11:54:50 PDT 2003
Hello all, in response to the problem I came across yesterday with MIME
attachments not having the correct content-subtype set when they are sent
by Eudora clients (in addition I've learned that the popular Unix client
Sylpheed does the same thing), I've created a patch based on how Jan says
it works in the current HEAD branch. This uses the MIME_Magic functionality
(that according to the documentation in Horde only began in Horde 2.2, so
at least that rev is required) to create the MIME subtype based on filename.
It SHOULD be fine... it's been working all day here with our 10,000 users
or so. But if anyone notices any issues, please let me know. Hopefully if
all goes well this can be committed for any future 3.2 branch upgrades
(limited though they may be).
Again, this is only for the STABLE (IMP 3.2.1) branch.
Thanks.
---
Tim Meader
ODIN Unix Group
ACS Government Services, Inc. - (301) 286-8013
Tim.Meader at gsfc.nasa.gov
-------------- next part --------------
*** Structure.php Fri Jan 3 07:48:25 2003
--- /usr/local/apache/htdocs/horde/lib/MIME/Structure.php Thu Jun 26 14:49:58 2003
***************
*** 126,131 ****
--- 126,158 ----
$object = new stdClass;
$object->ref = $ref;
$object->type = isset($part->type) ? $part->type : TYPETEXT;
+
+ // fix mime type problem in some mailer's attachments (mainly Eudora and Sylpheed)
+ if($part->subtype == "OCTET-STREAM")
+ {
+ if($part->ifdisposition)
+ {
+ if($part->disposition == "ATTACHMENT")
+ {
+ if($part->ifdparameters)
+ {
+ $num_objects = count($part->dparameters);
+
+ $object_ref = $part->dparameters[0];
+
+ if($object_ref->attribute == "FILENAME" || $object_ref->attribute == "NAME")
+ {
+ require_once dirname(__FILE__) . '/Magic.php';
+
+ $full_mime_type = MIME_Magic::filenameToMIME($object_ref->value);
+ $full_mime_type_exploded = explode("/", $full_mime_type);
+ $part->subtype = $full_mime_type_exploded[1];
+ }
+ }
+ }
+ }
+ }
+
$object->subtype = ($part->ifsubtype) ? strtolower($part->subtype) : 'x-unknown';
$object->encoding = isset($part->encoding) ? $part->encoding : MIME_DEFAULT_ENCODING;
$object->bytes = isset($part->bytes) ? $part->bytes : '?';
More information about the imp
mailing list