Application examples (Author: Chen Junqing, October 18, 2000 11:58) The class for receiving emails through POP3 has been introduced in detail in the previous article. Let’s take a look at how to apply this class: include("pop3.inc.php"); $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 "Total ".$rec->messages." letters, total ".$rec->size."byte size
"; ($rec->messages>0) { if (!$rec->listmail()) die($rec->err_str);
mail_list);$i++) { "; } $rec->getmail(1); echo "The content of the email header: "; for ($i=0;$i
head);$i++) echo htmlspecialchars($rec->head [$i])."
"; for ($i=0;$i
body);$i++) echo htmlspecialchars($rec->body[$i])."
"; } $rec->close(); ?> If you set debug in the pop3 class to true, you can also see how the program communicates with the pop3 server. For the program being debugged, like this It seems more intuitive. Summary From the above example, we can see that PHP is really a very powerful tool for website development, but we can also feel that PHP, as a hybrid language, is object-oriented. There are still many regrettable aspects in development compared with other tools such as Java. The implementation of this pop class also has many areas for improvement. Colleagues are welcome to provide guidance. Friends, please contact me: boss_ch@netease.com
http://www.bkjia.com/PHPjc/531906.html