POP3 to receive the mail class in the previous article has given you a detailed introduction, below we look at how to apply this class:
Include ("pop3.inc.php (as current mainstream development language)");
$host = "pop.china.com";
$user = "Boss_ch";
$pass = "026007";
$rec =new POP3 ($host, 110,2);
if (! $rec->open ()) Die ($rec->err_str);
echo "OPEN";
if (! $rec->login ($user, $pass)) die ($rec->err_str);
echo "Login";
if (! $rec->stat ()) Die ($rec->err_str);
echo "Shared". $rec->messages. " Letter, Total ". $rec->size." BYTE size
";
if ($rec->messages>0)
{
if (! $rec->listmail ()) Die ($rec->err_str);
echo "has the following letters:
";
for ($i =1; $i <=count ($rec->mail_list); $i + +)
{
echo "letter". $rec->mail_list[$i][num]. " Size: ". $rec->mail_list[$i][size]."
";
}
$rec->getmail (1);
echo "Message header content:
";
for ($i =0; $i Head), $i + +)
Echo htmlspecialchars ($rec->head[$i]). "
";
echo "Message body:
";
for ($i =0; $i body); $i + +)
Echo htmlspecialchars ($rec->body[$i]). "
";
}
$rec->close ();
?>
If you set debug to True in the POP3 class, you can also see how the program and the POP3 server are talking, which is more intuitive for the program being debugged.
Summary
From the above example we can see that PHP (as the mainstream development language now) is really a very powerful tool for web development, but also can feel that PHP (as the mainstream development of the current language) as a mixed-type language, its There are many regrets in the face of object development compared to other tools such as Java. This pop class implementation also has a lot of need to improve the place, welcome colleagues to guide.
http://www.bkjia.com/PHPjc/509084.html www.bkjia.com true http://www.bkjia.com/PHPjc/509084.html techarticle POP3 to receive the mail class in the previous article has given you a detailed introduction, below we look at how to apply this class: include ("pop3.inc.php" as the current mainstream development language ...