Page 1 of 1

imap_fetchstructure help

Posted: Fri Jun 25, 2004 8:01 am
by track_x
Hi All,

I construct a webmail for my website...
I have some trouble with the following function imap_fetchstructure...
I can not verify the real type of the mail (always TYPETEXT, i can not detected the size and if there are a attached file

here is a sample of the code and the result

code :

Code: Select all

<?php
$mbox = imap_open("{".$mailServer.":143/imap}INBOX",$user,$password);
 
    $objet = imap_fetchstructure($mbox, $msg);
    echo "\$objet->type:".$objet->type."<br />\n";
    echo "\$objet->encoding:".$objet->encoding."<br />\n";
    echo "\$objet->ifsubtype:".$objet->ifsubtype."<br />\n";
    echo "\$objet->subtype:".$objet->subtype."<br />\n";
    echo "\$objet->ifdescription:".$objet->ifdescription."<br />\n";
    echo "\$objet->ifid:".$objet->ifid."<br />\n";
    echo "\$objet->lines:".$objet->lines."<br />\n";
    echo "\$objet->bytes:".$objet->bytes."<br />\n";
    echo "\$objet->ifdisposition:".$objet->ifdisposition."<br />\n";
    echo "\$objet->ifdparameters:".$objet->ifdparameters."<br />\n";
    echo "\$objet->ifparameters:".$objet->ifparameters."<br />\n";
    echo "\$objet->parameters[0]->attribute:".$objet->parameters[0]->attribute."<br />\n";
    echo "\$objet->parameters[0]->value:".":".$objet->parameters[0]->value."<br />\n";
    echo "\$objet->parameters[1]->attribute:".$objet->parameters[1]->attribute."<br />\n";
    echo "\$objet->parameters[1]->value:".$objet->parameters[1]->value."<br />\n";
    imap_close($mbox);
?>
result :

Code: Select all

$objet-&gt;type:0
$objet-&gt;encoding:0
$objet-&gt;ifsubtype:0
$objet-&gt;subtype:
$objet-&gt;ifdescription:0
$objet-&gt;ifid:0
$objet-&gt;lines:
$objet-&gt;bytes:
$objet-&gt;ifdisposition:0
$objet-&gt;ifdparameters:0
$objet-&gt;ifparameters:0
$objet-&gt;parameters&#1111;0]-&gt;attribute:
$objet-&gt;parameters&#1111;0]-&gt;value::
$objet-&gt;parameters&#1111;1]-&gt;attribute:
$objet-&gt;parameters&#1111;1]-&gt;value:
it seem's that the function miss some parameter as type, bytes,...
Can someone can help me or fix why i have this problem... i have read some post that could be a bug of imap_fetchstructure

thanks in advance for your help


feyd | added

Code: Select all

and

Code: Select all

tags :: [/color][url=http://forums.devnetwork.net/viewtopic.php?t=21171][color=red]:arrow: [u][b]Posting Code in the Forums[/b][/u][/color][/url]

Posted: Fri Jun 25, 2004 10:27 am
by feyd
have you tried [php_man]var_dump[/php_man]() or [php_man]print_r[/php_man]() against $objet?

Posted: Fri Jun 25, 2004 11:07 am
by track_x
thanks for your reply

i have tried

code :

Code: Select all

var_dump($objet)
result :

Code: Select all

object(stdClass)(9) &#123; &#1111;"type"]=&gt; int(0) &#1111;"encoding"]=&gt; int(0) &#1111;"ifsubtype"]=&gt; int(0) &#1111;"ifdescription"]=&gt; int(0) &#1111;"ifid"]=&gt; int(0) &#1111;"ifdisposition"]=&gt; int(0) &#1111;"ifdparameters"]=&gt; int(0) &#1111;"ifparameters"]=&gt; int(0) &#1111;"parameters"]=&gt; object(stdClass)(0) &#123; &#125; &#125;
code :

Code: Select all

print_r($objet)

result :

Code: Select all

stdClass Object ( &#1111;type] =&gt; 0 &#1111;encoding] =&gt; 0 &#1111;ifsubtype] =&gt; 0 &#1111;ifdescription] =&gt; 0 &#1111;ifid] =&gt; 0 &#1111;ifdisposition] =&gt; 0 &#1111;ifdparameters] =&gt; 0 &#1111;ifparameters] =&gt; 0 &#1111;parameters] =&gt; stdClass Object ( ) )
it seems that the function imap_fetchstructure can not obtain the real info about the mail

for exemple :

read a mail multipart with a attached file 500kb

result :

Code: Select all

$objet-&gt;type:0
$objet-&gt;encoding:0
$objet-&gt;ifsubtype:0
$objet-&gt;subtype:
$objet-&gt;ifdescription:0
$objet-&gt;ifid:0
$objet-&gt;lines:
$objet-&gt;bytes:
$objet-&gt;ifdisposition:0
$objet-&gt;ifdparameters:0
$objet-&gt;ifparameters:0
$objet-&gt;parameters&#1111;0]-&gt;attribute:
$objet-&gt;parameters&#1111;0]-&gt;value::
$objet-&gt;parameters&#1111;1]-&gt;attribute:
$objet-&gt;parameters&#1111;1]-&gt;value:
it seems that the function does not recognize any type always type TYPETEXT and PLAIN what can i do to fix that but the other imap function (imap_header,imap_headerinfo,.....) working very great

thanks in advance for your help

track

Posted: Fri Jun 25, 2004 5:08 pm
by track_x
i found the issue
just open the box with pop3 protocol

Code: Select all

$mbox = imap_open("{".$mailServer.":110/pop3}INBOX",$user,$password);
instead

Code: Select all

$mbox = imap_open("{".$mailServer.":143/imap}INBOX",$user,$password);
maybe winmail server use pop3 for email but imap service working.
now it 's working but i'd like to have the answer why pop3 instead imap

thanks in advance