Revision: 2828
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 23, 2007 19:51 by d4rk
Initial Code
<?php
// include class
include("Net/POP3.php");
// initialize object
$pop3 = new Net_POP3();
// attempt connection to server
if (!$pop3->connect("example.com", 110)) {
die("Error in connection");
}
// attempt login
$ret = $pop3->login("john", "doe");
if (is_a($ret, 'PEAR_Error')) {
die("Error in authentication: " . $ret->getMessage());
}
// print number of messages found
echo $pop3->numMsg() . " message(s) in mailbox\n";
// print message headers
if ($pop3->numMsg() > 0) {
for ($x=1; $x<=$pop3->numMsg(); $x++) {
$hdrs = $pop3->getParsedHeaders($x);
echo $hdrs['From'] . "\n" . $hdrs['Subject'] . "\n\n";
}
}
// disconnect from server
$pop3->disconnect();
?>
Initial URL
http://www.melonfire.com/community/columns/trog/print.php?id=275
Initial Description
Initial Title
Retrieve email via POP3 with PEAR
Initial Tags
php
Initial Language
PHP