The mail receiving class of the application instance POP3 has already been described in detail in the previous article. let's take a look at how to apply this class: & lt ;? Include (pop3.inc. php); $ hostpop.china.com; $ userboss_ch; $ pass026007; $ recnewpop3 ($ host, 110,2); if (! $ Rec-application instance
The POP3 mail receiving class has already been described 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 "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; $ I Head); $ I ++)
Echo htmlspecialchars ($ rec-> head [$ I])."
\ N ";
Echo "email body:
";
For ($ I = 0; $ I Body); $ I ++)
Echo htmlspecialchars ($ rec-> body [$ I])."
\ N ";
}
$ Rec-> close ();
?>
If you set debug to true in the pop3 class, you can also see how the program communicates with the pop3 server. this is more intuitive for the program 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. thank you for your guidance.