Post office PHP application-POP3 mail receipt (2) _ PHP Tutorial

Source: Internet
Author: User
Post office PHP application-receiving POP3 mail (2 ). 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 (as the mainstream development language POP3, the 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 (as the 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 "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])."
";
  
Echo "email 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 communicates with the pop3 server. this is more straightforward for the program being debugged.
  
   Summary
From the above example, we can see that php (as the mainstream development language) is really a powerful tool for website development, but we can also feel that, php (as the mainstream development language) is a hybrid language. it faces a lot of pity over object development and other tools such as java. There are still many improvements to the implementation of this pop class. You are welcome to provide guidance.

Using include ("pop3.inc. php (as the mainstream development language...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.