[Tickets #1463] NEW: Message previews sometimes show MIME-glut

bugs at bugs.horde.org bugs at bugs.horde.org
Tue Mar 1 08:01:46 PST 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=1463
-----------------------------------------------------------------------
 Ticket             | 1463
 Created By         | oliver at gtwebmarque.com
 Summary            | Message previews sometimes show MIME-glut
 Queue              | IMP
 Version            | 4.0.2
 State              | Unconfirmed
 Priority           | 1. Low
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


oliver at gtwebmarque.com (2005-03-01 08:01) wrote:

Some messages contain information at the top about the MIME parts, see the
sample at the end for an example. This causes message previews to display
this ugly text instead of the start of the actual message.

A partial fix/hack is to remove the MIME info from the preview with a regex.
In horde/imp/lib/Mailbox.php, after line
294: $ptext = trim(strip_tags(@imap_fetchbody($imp['stream'],
$header->msgno, 1)));
insert the line
$ptext = preg_replace('/^.*Content\-Transfer\-Encoding\:.*?\n/s', '',
$ptext, 1);

This only works if the first message part, that imap_fetchbody fetches is
the plain text part. If it is an attachment or something then we can never
get the text from it. To handle all situations, we'd have to add in some
code to make sure we fetch the plain-text part of the message (if there is
one of course) to use for the preview.

** BEGIN MESSAGE SAMPLE **
This is a multi-part message in MIME format.
--------------050807000301030204090007
Content-Type: multipart/alternative;
 boundary="------------010801040006060501020508"


--------------010801040006060501020508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
** END MESSAGE SAMPLE **




More information about the bugs mailing list