Page 1 of 1

[SOLVED]Problem: imap_fetchstructure() doesn't get all parts

Posted: Wed Dec 29, 2004 4:25 am
by Chris Corbyn
Hi,

I'm using imap_fetchstructure() on both a localhost IMAP email account and an external one.

I've made a duplicate of the messages on the external account into my localhost account and I have generated a list of subjects alongside the number of the email to verify both are the same.

On the localhost account imap_fetchstructure() returns all messages as either multipart (but only one part included) or not multipart even if the external account shows them as multipart.

Example ::
External account on msg number 212
stdClass Object
(
[type] => 1
[encoding] => 0
[ifsubtype] => 1
[subtype] => ALTERNATIVE
[ifdescription] => 0
[ifid] => 0
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => boundary
[value] => 1102462256763.MimeBoundarY
)

)

[parts] => Array
(
[0] => stdClass Object
(
[type] => 0
[encoding] => 4
[ifsubtype] => 1
[subtype] => PLAIN
[ifdescription] => 0
[ifid] => 0
[lines] => 112
[bytes] => 4255
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => charset
[value] => ISO-8859-1
)

)

)

[1] => stdClass Object
(
[type] => 0
[encoding] => 4
[ifsubtype] => 1
[subtype] => HTML
[ifdescription] => 0
[ifid] => 0
[lines] => 278
[bytes] => 14599
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => charset
[value] => ISO-8859-1
)

)

)

)

)
and the internal one on also on Msg 212
stdClass Object
(
[type] => 1
[encoding] => 0
[ifsubtype] => 1
[subtype] => MIXED
[ifdescription] => 0
[ifid] => 0
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 0
[parameters] => Array
(
)

[parts] => Array
(
[0] => stdClass Object
(
[type] => 0
[encoding] => 4
[ifsubtype] => 1
[subtype] => PLAIN
[ifdescription] => 0
[ifid] => 0
[lines] => 112
[bytes] => 4257
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => charset
[value] => ISO-8859-1
)

)

)


)

)
As you can see both emails have the equal number of lines but the second part is missing in the localhost one and the type is MIXED not ALTERNATIVE.

Also the parameters are missing. Is this the way I have configured my localhost mail server (MailTraq)?

Cheers

Posted: Wed Dec 29, 2004 4:56 am
by Chris Corbyn
The weird thing is the Netscape Mail handles the email just fine and displays the same things as it's original copy on the external server. But imap_fetchstructure() in PHP does not seem to read them both the same.

If I display the body of the messages they are both identical with multipart MIME. But obviously this makes the email display all screwy unless I can get the PHP to determine the fact that the message is multipart.

I hope I'm, not going to need to write a whole complex chunk of code for determining the MIME type since imap_fetchstructure() should do this.

It was working just fine with my external account and now since I'm trying to use a localhost account it's not working :-(

Posted: Wed Dec 29, 2004 7:02 am
by Chris Corbyn
I'm also getting stupid outputs like

Code: Select all

$structure->parts[$i]->encoding == 6; //The damn thing should only count to 5!!!

Posted: Wed Dec 29, 2004 7:47 am
by Chris Corbyn
I've changed the server it looks at to be the POP3 server running for the exact same account and this works a treat. I guess it could be an issue with my IMAP server itself?

Posted: Tue Jan 11, 2005 5:58 pm
by Chris Corbyn
This topic can be closed. It turned out to be a problem with the IMAP server I was running on localhost after speaking with the makers of the server. :-D