For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2004 > smtp read mail from server and download in apache









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author smtp read mail from server and download in apache
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


Manuel Lemos

2004-12-27, 3:55 pm

Hello,

on 12/27/2004 02:14 PM Red Owl said the following:
> exist an good source code for read smtp mail or functionaly example
> (i not use pear)


I think you mean reading messages from a POP3 server.

In that case you may want to try this POP3 client class that lets you
retrieve messages in a mailbox accessible via POP3 protocol.

http://www.phpclasses.org/pop3class


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com