|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13465 imap_fetchstructure problem
Submitted: 2001-09-26 22:05 UTC Modified: 2001-10-19 02:42 UTC
From: seung_hwan at hotmail dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.0.6 OS: Red Hat 7.1 (Seawolf)
Private report: No CVE-ID: None
 [2001-09-26 22:05 UTC] seung_hwan at hotmail dot com
The list of modules I compiled PHP with:
./configure --with-apxs=/usr/local/apache/bin/apxs \
            --with-mysql=/usr/local/mysql \
            --with-imap=/usr/local/imap \
            --with-language=korean \
            --with-charset=euc_kr \
            --with-zlib \
            --enable-track-vars \
            --disbale-debug \
            --enable-modules=so \
            --with-config-file-path=/usr/local/apache/conf \

My server environments:
   OS     - Red Hat 7.1
   PHP    - 4.0.6
   qmail  - 1.03
   imap   - 4.7
   apache - 1.3.20
   mysql  - 3.23.39

If a mail header contains 'Mime-Version: 1.0', imap_fetchstructure works ok.
However If not, imap_fetchstructure always returns the type value as text and the subtype value as plain.

For example, suppose I receive the following mail.

Received: from by gaultier with Microsoft SMTPSVC(5.0.2172.1);
	 Tue, 25 Sep 2001 11:34:08 +0900
Received: (qmail 31008 invoked by uid 99); 25 Sep 2001 11:39:49 +0900(KST)
Date: 25 Sep 2001 11:39:49 +0900(KST)
Message-ID: <>
Subject: test
Content-Type: text/html; charset=ks_c_5601-1987
X-OriginalArrivalTime: 25 Sep 2001 02:34:08.0868 (UTC) FILETIME=[8DAA4240:01C1456A]

<iframe frameborder="0" scrolling="no" topmargin="0" leftmargin="0" src="" width="620" height="450"></iframe>

The mail content type is text/html, but imap_fetchstructure returns the content type as text/plain because there is not 'Mime-Version: 1.0' in the mail header.
If the mail header contains 'Mime-Version: 1.0', imap_fetchstructure works properly.

Is this a kind of bug?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-19 00:00 UTC] seung_hwan at hotmail dot com
Nobody knows how to solve this problem???
 [2001-10-19 02:42 UTC]
If it is a bug (which I doubt), it's not a PHP bug, but a bug in the library that the imap extension used. I recommend to check this out with the imap guys.

Not a PHP bug > bogus.
 [2003-01-22 08:30 UTC] tm at bogs dot de
I've found the following explanation for this problem
(although many mail clients interpret the content as html, imap do not so, but it seems to be an error on side of the sender not of the receiver):

Once again, let me emphasize that "Content-Type: text/html" without the
mandatory MIME-Version header is garbage.  It violates both MIME and the older

See also:
 [2004-06-07 18:08 UTC] se at designlinks dot net
OK - so how do we get in touch with the IMAP guys to correct this 'issue'?

I agree that the fault lies squarely on the shoulders of the sender for not adding the mandatory MIME-version header, but surely imap_fetchstructure can deal with the missing header.

Eh - what if we just inject the mandatory field into the header before calls to this function (whether or not the field is already there?)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 22:01:30 2024 UTC