php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30538 imap_fetchstructure() different on POP3 to IMAP4
Submitted: 2004-10-23 14:13 UTC Modified: 2004-12-12 01:38 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: richard at dominion-web dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.3.9 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: richard at dominion-web dot com
New email:
PHP Version: OS:

 

 [2004-10-23 14:13 UTC] richard at dominion-web dot com
Description:
------------
If I run an imap_fetchstructure() on POP3 on a multipart/mixed message with a file attachment I get

object(stdClass)(12) {
  ["type"]=>
  int(1)
  ["encoding"]=>
  int(0)
  ["ifsubtype"]=>
  int(1)
  ["subtype"]=>
  string(5) "MIXED"
  ["ifdescription"]=>
  int(0)
  ["ifid"]=>
  int(0)
  ["bytes"]=>
  int(337991)
  ["ifdisposition"]=>
  int(0)
  ["ifdparameters"]=>
  int(0)
  ["ifparameters"]=>
  int(1)
  ["parameters"]=>
  array(1) {
    [0]=>
    object(stdClass)(2) {
      ["attribute"]=>
      string(8) "BOUNDARY"
      ["value"]=>
      string(41) "----=_NextPart_000_004B_01C4B881.82B4DE80"
    }
  }
  ["parts"]=>
  array(2) {
    [0]=>
    object(stdClass)(12) {
      ["type"]=>
      int(0)
      ["encoding"]=>
      int(0)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(5) "PLAIN"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["lines"]=>
      int(18)
      ["bytes"]=>
      int(439)
      ["ifdisposition"]=>
      int(0)
      ["ifdparameters"]=>
      int(0)
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(7) "CHARSET"
          ["value"]=>
          string(10) "iso-8859-1"
        }
      }
    }
    [1]=>
    object(stdClass)(13) {
      ["type"]=>
      int(5)
      ["encoding"]=>
      int(3)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(4) "JPEG"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["bytes"]=>
      int(337122)
      ["ifdisposition"]=>
      int(1)
      ["disposition"]=>
      string(10) "ATTACHMENT"
      ["ifdparameters"]=>
      int(1)
      ["dparameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(8) "FILENAME"
          ["value"]=>
          string(14) "email left.jpg"
        }
      }
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(4) "NAME"
          ["value"]=>
          string(14) "email left.jpg"
        }
      }
    }
  }
}

If I run exactly the same code under an IMAP4 extension I get

object(stdClass)(11) {
  ["type"]=>
  int(1)
  ["encoding"]=>
  int(0)
  ["ifsubtype"]=>
  int(1)
  ["subtype"]=>
  string(5) "MIXED"
  ["ifdescription"]=>
  int(0)
  ["ifid"]=>
  int(0)
  ["ifdisposition"]=>
  int(0)
  ["ifdparameters"]=>
  int(0)
  ["ifparameters"]=>
  int(0)
  ["parameters"]=>
  object(stdClass)(0) {
  }
  ["parts"]=>
  array(1) {
    [0]=>
    object(stdClass)(12) {
      ["type"]=>
      int(0)
      ["encoding"]=>
      int(0)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(5) "PLAIN"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["lines"]=>
      int(19)
      ["bytes"]=>
      int(441)
      ["ifdisposition"]=>
      int(0)
      ["ifdparameters"]=>
      int(0)
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(7) "charset"
          ["value"]=>
          string(10) "iso-8859-1"
        }
      }
    }
  }
}

It doesn't seem to be c-client related as it seems to work connecting to other mail servers from the same web server, however connecting to this particular exim server produces this problem.

I am retrieving message UID's and not sequence IDs and the actual body of the message is displayed correctly, just the attachment missing.

The email source is as follows (headers changed to protect details and image condensed on purpose for size but I have kept the exact structure and number of carriage returns)

Subject: Test Email Attachment.
Date: Fri, 22 Oct 2004 21:53:05 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_004B_01C4B881.82B4DE80"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Importance: Normal



This is a multi-part message in MIME format.

------=_NextPart_000_004B_01C4B881.82B4DE80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Body of message
--------------------------------------------------------
Signature
-------------------------------------------------------- 
------=_NextPart_000_004B_01C4B881.82B4DE80
Content-Type: image/jpeg;
	name="email left.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="email left.jpg"

[snip]base64 encoded jpeg[/snip]

------=_NextPart_000_004B_01C4B881.82B4DE80--




Reproduce code:
---------------
$structure = imap_fetchstructure($mailbox, $msgid, FT_UID);

Expected result:
----------------
Retrieves body of message and one image file attachment in the structure

Actual result:
--------------
Retrieves body of message and no image files attachments in the structure

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-12 01:38 UTC] sniper@php.net
We use the c-client function mail_fetchstructure_full() here.
If that function misbehaves like you say, report to the c-client author. This is not PHP bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC