Electronic Post Office PHP application--POP3 Mail Collection (ii) _php tutorial

Source: Internet
Author: User
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 ...

  • 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.