Introduction: This is a detailed page for collecting POP3 mails using PHP (3). It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 324419 'rolling = 'no'>
Application Instance
POP3 received mail class beforeArticleThe following describes 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 "A total of". $ rec-> messages. "mails, a total of". $ rec-> size. "bytes
";
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 "mail header content:
";
For ($ I = 0; $ ihead); $ I ++)
Echo htmlspecialchars ($ rec-> head [$ I])."
N ";
Echo "email body:
";
For ($ I = 0; $ ibody); $ I ++)
Echo htmlspecialchars ($ rec-> body [$ I])."
N ";
}
$ Rec-> close ();
?>
If you set debug in POP3 to true, you can also seeProgramThe dialog with POP3 server is more intuitive for programs being debugged.
Summary
From the above example, we can see that PHP is really a powerful tool developed by the website, but we can also feel that PHP is a hybrid language, compared with other tools such as Java, object development still has a lot of regrets. There are still many improvements to the implementation of this pop class. You are welcome to provide guidance.
Author: Chen junqing
If you want to obtain the completeSource codePlease contact me: boss_ch@netease.com
Reprinted: chinacnet
More articles about "Use PHP to collect POP3 mails (3)"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/324419.html pageno: 14