| Red Owl 2004-12-27, 3:55 pm |
| i have a problem to read mail message form smtp server
i have write this code:
<?
echo "pp";
$mbox = imap_open("{pop.191.it}INBOX","prova@example.com","PASSWORD");
if(!$mbox){
echo "merdaccia";
exit;
}
$check = imap_mailboxmsginfo($mbox);
if ($check) {
echo "Date: " . $check->Date . "<br />\n" ;
echo "Driver: " . $check->Driver . "<br />\n" ;
echo "Mailbox: " . $check->Mailbox . "<br />\n" ;
echo $msg['num'] = $check->Nmsgs;
echo "Recent: " . $check->Recent . "<br />\n" ;
echo "Unread: " . $check->Unread . "<br />\n" ;
echo "Deleted: " . $check->Deleted . "<br />\n" ;
echo "Size: " . $check->Size . "<br />\n" ;
} else {
echo "imap_check() failed: " . imap_last_error() . "<br />\n";
}
echo "<pre>";
/*
for($i=1; $i<$msg['num']+1; $i++){
echo imap_fetchheader($mbox, $i);
echo "body:<br>";
$body = imap_fetchstructure($mbox,$i);
var_dump($body);
echo "<hr>";
}
echo "</pre>";
*/
$mnum = 1;
echo $nummessages = imap_num_msg($mbox);
echo $body = imap_fetchbody($mbox, $mnum, 2);
var_dump($body);
echo "<hr>";
$struct = imap_fetchstructure($mbox, $mnum);
var_dump($struct);
$parti = $struct->parts;
$bo = count($parti);
echo "<hr>";
for($i=0; $i<$bo; $i++){
//switch(
$read_part = $struct->parts[$i];
var_dump($read_part);
}
// $strFileName = $att[$file]->parameters[0]->value;
// $strFileType = strrev(substr(strrev($strFileName),0,4))
;
// $fileContent = imap_fetchbody($mbox,$id,$file+2);
// echo $thefile = imap_base64($fileContent);
//$struct = imap_fetchstructure($mbox, $mnum);
//$vv = buildparts($mbox, $mnum, $struct);
imap_close($mbox);
?>
exist an good source code for read smtp mail or functionaly example
(i not use pear)
trancks
|