Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Odbieranie poczyty pop3 - klasa -
Forum PHP.pl > Forum > PHP
fiasko
Poszukuję klasy do obierania poczty przez pop3 z funkcją kasowania wiadomości z serwera i czytania załączników. Ma może ktoś coś takiego ?
Bags_Bunny
Zend Mail. Pisałem o tym niedawno w innym Twoim temacie. Korzystanie z forum to nie tylko zadawanie pytań.
fiasko

Nie kasuje mi emaili. Dlaczego ?

  1. <?php
  2.  
  3. include($_SERVER ['DOCUMENT_ROOT'] .'/xmailer/include/config.php');
  4. include($_SERVER ['DOCUMENT_ROOT'] .'/xmailer/include/connect.php');
  5.  
  6. /*
  7.  * test_pop3.php
  8.  *
  9.  * @(#) $Header: test_pop3.php,v 1.7 2006/06/11 14:52:09 mlemos Exp $
  10.  *
  11.  */
  12.  
  13. ?>
  14. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  15. <HTML>
  16. <HEAD>
  17. <TITLE>Test odbioru email</TITLE>
  18. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  19. </HEAD>
  20. <BODY>
  21. <?php
  22.  
  23. require("/home/xxxxx/domains/xxxxxx.pl/public_html/xmailer/klasa_phpmail/pop3.php");
  24.  
  25. /* Uncomment when using SASL authentication mechanisms */
  26. /*
  27. require("sasl.php");
  28. */
  29.  
  30. $pop3=new pop3_class;
  31. //$pop3->hostname="localhost"; /* POP 3 server host name */
  32.  
  33. $pop3->hostname="mail.xxxxxxxxx.pl";
  34. $pop3->port=110; /* POP 3 server host port,
  35. usually 110 but some servers use other ports
  36. Gmail uses 995 */
  37. $pop3->tls=0; /* Establish secure connections using TLS */
  38. $user="info@xxxxxxx.pl"; /* Authentication user name */
  39. $password="xxxxxxxxx"; /* Authentication password */
  40. $pop3->realm=""; /* Authentication realm or domain */
  41. $pop3->workstation=""; /* Workstation for NTLM authentication */
  42. $apop=0; /* Use APOP authentication */
  43. $pop3->authentication_mechanism="USER"; /* SASL authentication mechanism */
  44. $pop3->debug=1; /* Output debug information */
  45. $pop3->html_debug=1; /* Debug information is in HTML */
  46. $pop3->join_continuation_header_lines=1; /* Concatenate headers split in multiple lines */
  47.  
  48.  
  49. if(($error=$pop3->Open())=="")
  50. {
  51. echo "<PRE>Połączono z serwerem ".$pop3->hostname."&quot;.</PRE>\n";
  52. if(($error=$pop3->Login($user,$password,$apop))=="")
  53. {
  54. echo "<PRE>User &quot;$user&quot; logged in.</PRE>\n";
  55. if(($error=$pop3->Statistics($messages,$size))=="")
  56. {
  57. echo "<PRE>Są… $messages wiadomości w szkrzynce o wielkości $size bitów.</PRE>\n";
  58. $result=$pop3->ListMessages("",0);
  59. if(GetType($result)=="array")
  60. {
  61.  
  62. for(Reset($result),$message=0;$message<count($result);Next($result),$message++)
  63. echo "<PRE>WIADOMOŚĆI ",Key($result)," - ",$result[Key($result)]," bitów.</PRE>\n";
  64.  
  65.  
  66. $result=$pop3->ListMessages("",1);
  67. if(GetType($result)=="array")
  68. {
  69. for(Reset($result),$message=0;$message<count($result);Next($result),$message++)
  70. echo "<PRE>WIADOMOŚĆI ",Key($result),", Unique ID - \"",$result[Key($result)],"\"</PRE>\n";
  71.  
  72.  
  73.  
  74. if($messages>0)
  75. {
  76. echo 'są' ;
  77.  
  78.  
  79.  
  80. if(($error=$pop3->DeleteMessage(1))=="")
  81. {
  82. echo "<PRE>Oznaczono wiadomość do skasowania.</PRE>\n";
  83. if(($error=$pop3->ResetDeletedMessages())=="")
  84. {
  85. echo "<PRE>Resetted the list of messages to be deleted.</PRE>\n";
  86. }
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. } //if mesagnes ile
  101.  
  102.  
  103.  
  104. if($error==""
  105. && ($error=$pop3->Close())=="")
  106. echo "<PRE>Disconnected from the POP3 server &quot;".$pop3->hostname."&quot;.</PRE>\n";
  107. }
  108. else
  109. $error=$result;
  110.  
  111.  
  112. }
  113. else
  114. $error=$result;
  115. }
  116. }
  117. }
  118. if($error!="")
  119. echo "<H2>Error: ",HtmlSpecialChars($error),"</H2>";
  120.  
  121.  
  122.  
  123.  
  124.  
  125. ?>
  126.  
  127.  
  128.  
  129. </BODY>
  130. </HTML>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.