home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _a1297515e8ff7dca99ab9b92417e7976 < prev    next >
Text File  |  2000-03-23  |  11KB  |  294 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Mail::POP3Client - Perl 5 module to talk to a POP3 server</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Mail::POP3Client - Perl 5 module to talk to a POP3 server</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#examples">EXAMPLES</A></LI>
  26.     <LI><A HREF="#constructors">CONSTRUCTORS</A></LI>
  27.     <LI><A HREF="#methods">METHODS</A></LI>
  28.     <LI><A HREF="#author">AUTHOR</A></LI>
  29.     <LI><A HREF="#credits">CREDITS</A></LI>
  30.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  31. </UL>
  32. <!-- INDEX END -->
  33.  
  34. <HR>
  35. <P>
  36. <H1><A NAME="name">NAME</A></H1>
  37. <P>Mail::POP3Client - Perl 5 module to talk to a POP3 (RFC1939) server</P>
  38. <P>
  39. <HR>
  40. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  41. <UL>
  42. <LI>Linux</LI>
  43. <LI>Solaris</LI>
  44. <LI>Windows</LI>
  45. </UL>
  46. <HR>
  47. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  48. <PRE>
  49.   use Mail::POP3Client;
  50.   $pop = new Mail::POP3Client( USER     => "me",
  51.                                PASSWORD => "mypassword",
  52.                                HOST     => "pop3.do.main" );
  53.   for( $i = 1; $i <= $pop->Count(); $i++ ) {
  54.     foreach( $pop->Head( $i ) ) {
  55.       /^(From|Subject):\s+/i && print $_, "\n";
  56.     }
  57.   }
  58.   $pop->Close();
  59.   # OR
  60.   $pop2 = new Mail::POP3Client( HOST  => "pop3.otherdo.main" );
  61.   $pop2->User( "somebody" );
  62.   $pop2->Pass( "doublesecret" );
  63.   $pop2->Connect() || die $pop2->Message();
  64.   $pop2->Close();</PRE>
  65. <P>
  66. <HR>
  67. <H1><A NAME="description">DESCRIPTION</A></H1>
  68. <P>This module implements an Object-Oriented interface to a POP3 server.
  69. It implements RFC1939 (http://www.faqs.org/rfcs/rfc1939.html)</P>
  70. <P>
  71. <HR>
  72. <H1><A NAME="examples">EXAMPLES</A></H1>
  73. <P>Here is a simple example to list out the From: and Subject: headers in
  74. your remote mailbox:</P>
  75. <PRE>
  76.   #!/usr/local/bin/perl
  77. </PRE>
  78. <PRE>
  79.  
  80.   use Mail::POP3Client;</PRE>
  81. <PRE>
  82.  
  83.   $pop = new Mail::POP3Client( USER     => "me",
  84.                                PASSWORD => "mypassword",
  85.                                HOST     => "pop3.do.main" );
  86.   for ($i = 1; $i <= $pop->Count(); $i++) {
  87.     foreach ( $pop->Head( $i ) ) {
  88.       /^(From|Subject):\s+/i and print $_, "\n";
  89.     }
  90.     print "\n";
  91.   }</PRE>
  92. <P>
  93. <HR>
  94. <H1><A NAME="constructors">CONSTRUCTORS</A></H1>
  95. <P>Old style (deprecated):
  96.    new Mail::POP3Client( USER, PASSWORD [, HOST, PORT, DEBUG, AUTH_MODE] );</P>
  97. <P>New style (shown with defaults):
  98.    new Mail::POP3Client( USER      => ``'',
  99.                          PASSWORD  => ``'',
  100.                          HOST      => ``pop3'',
  101.                          PORT      => 110,
  102.                          AUTH_MODE => 'PASS',
  103.                          DEBUG     => 0,
  104.                          TIMEOUT   => 60,
  105.                        );</P>
  106. <UL>
  107. <LI><STRONG><A NAME="item_USER_is_the_userID_of_the_account_on_the_POP_serve">USER is the userID of the account on the POP server</A></STRONG><BR>
  108.  
  109. <LI><STRONG><A NAME="item_PASSWORD_is_the_cleartext_password_for_the_userID">PASSWORD is the cleartext password for the userID</A></STRONG><BR>
  110.  
  111. <LI><STRONG><A NAME="item_address">HOST is the POP server name or IP address (default = 'pop3')</A></STRONG><BR>
  112.  
  113. <LI><STRONG><A NAME="item_port">PORT is the POP server port (default = 110)</A></STRONG><BR>
  114.  
  115. <LI><STRONG><A NAME="item_debugging">DEBUG - any non-null, non-zero value turns on debugging (default = 0)</A></STRONG><BR>
  116.  
  117. <LI><STRONG><A NAME="item_APOP">AUTH_MODE - pass 'APOP' to attempt APOP (MD5) authorization. (default is 'PASS')</A></STRONG><BR>
  118.  
  119. <LI><STRONG><A NAME="item_operations">TIMEOUT - set a timeout value for socket operations (default = 60)</A></STRONG><BR>
  120.  
  121. </UL>
  122. <P>
  123. <HR>
  124. <H1><A NAME="methods">METHODS</A></H1>
  125. <P>These commands are intended to make writing a POP3 client easier.
  126. They do not necessarily map directly to POP3 commands defined in
  127. RFC1081 or RFC1939, although all commands should be supported.  Some
  128. commands return multiple lines as an array in an array context.</P>
  129. <DL>
  130. <DT><STRONG><A NAME="item_new"><EM>new</EM>( USER => 'user', PASSWORD => 'password', HOST => 'host',
  131.               PORT => 110, DEBUG => 0, AUTH_MODE => 'PASS', TIMEOUT => 60 )</A></STRONG><BR>
  132. <DD>
  133. Construct a new POP3 connection with this.  You should use the
  134. hash-style constructor.  <STRONG>The old positional constructor is
  135. deprecated and will be removed in a future release.  It is strongly
  136. recommended that you convert your code to the new version.</STRONG>
  137. <P>You should give it at least 2 arguments: USER and PASSWORD.  The
  138. default HOST is 'pop3' which may or may not work for you.  You can
  139. specify a different PORT (be careful here).</P>
  140. <P>new will attempt to Connect to and Login to the POP3 server if you
  141. supply a USER and PASSWORD.  If you do not supply them in the
  142. constructor, you will need to call Connect yourself.</P>
  143. <P>The valid values for AUTH_MODE are 'PASS' and 'APOP'.  APOP implies
  144. that an MD5 checksum will be used instrad of passing your password in
  145. cleartext.  However, <STRONG>if the server does not support APOP, the
  146. cleartext method will be used.  Be careful.</STRONG></P>
  147. <P>If you enable debugging with DEBUG => 1, messages about command will
  148. go to STDERR.</P>
  149. <P>Another warning, it's impossible to differentiate between a timeout
  150. and a failure.</P>
  151. <P></P>
  152. <DT><STRONG><A NAME="item_Head"><EM>Head</EM>( MESSAGE_NUMBER )</A></STRONG><BR>
  153. <DD>
  154. Get the headers of the specified message, either as an array or as a
  155. string, depending on context.
  156. <P>You can also specify a number of preview lines which will be returned
  157. with the headers.  This may not be supported by all POP3 server
  158. implementations as it is marked as optional in the RFC.  Submitted by
  159. Dennis Moroney <<A HREF="mailto:dennis@hub.iwl.net">dennis@hub.iwl.net</A>>.</P>
  160. <P></P>
  161. <DT><STRONG><A NAME="item_Body"><EM>Body</EM>( MESSAGE_NUMBER )</A></STRONG><BR>
  162. <DD>
  163. Get the body of the specified message, either as an array of lines or
  164. as a string, depending on context.
  165. <P></P>
  166. <DT><STRONG><A NAME="item_HeadAndBody"><EM>HeadAndBody</EM>( MESSAGE_NUMBER [, PREVIEW_LINES ] )</A></STRONG><BR>
  167. <DD>
  168. Get the head and body of the specified message, either as an array of
  169. lines or as a string, depending on context.
  170. <DL>
  171. <DT><STRONG><A NAME="item_Example">Example</A></STRONG><BR>
  172. <DD>
  173. foreach ( $pop->HeadAndBody( 1, 10 ) )
  174.    print $_, ``\n'';
  175. <P>prints out a preview of each message, with the full header and the
  176. first 10 lines of the message (if supported by the POP3 server).</P>
  177. <P></P></DL>
  178. <DT><STRONG><A NAME="item_Retrieve"><EM>Retrieve</EM>( MESSAGE_NUMBER )</A></STRONG><BR>
  179. <DD>
  180. Same as HeadAndBody.
  181. <P></P>
  182. <DT><STRONG><A NAME="item_Delete"><EM>Delete</EM>( MESSAGE_NUMBER )</A></STRONG><BR>
  183. <DD>
  184. Mark the specified message number as DELETED.  Becomes effective upon
  185. QUIT.  Can be reset with a Reset message.
  186. <P></P>
  187. <DT><STRONG><A NAME="item_Connect"><EM>Connect</EM></A></STRONG><BR>
  188. <DD>
  189. Start the connection to the POP3 server.  You can pass in the host and
  190. port.
  191. <P></P>
  192. <DT><STRONG><A NAME="item_Close"><EM>Close</EM></A></STRONG><BR>
  193. <DD>
  194. Close the connection gracefully.  POP3 says this will perform any
  195. pending deletes on the server.
  196. <P></P>
  197. <DT><STRONG><A NAME="item_Alive"><EM>Alive</EM></A></STRONG><BR>
  198. <DD>
  199. Return true or false on whether the connection is active.
  200. <P></P>
  201. <DT><STRONG><A NAME="item_Socket"><EM>Socket</EM></A></STRONG><BR>
  202. <DD>
  203. Return the file descriptor for the socket.
  204. <P></P>
  205. <DT><STRONG><A NAME="item_Size"><EM>Size</EM></A></STRONG><BR>
  206. <DD>
  207. Set/Return the size of the remote mailbox.  Set by POPStat.
  208. <P></P>
  209. <DT><STRONG><A NAME="item_Count"><EM>Count</EM></A></STRONG><BR>
  210. <DD>
  211. Set/Return the number of remote messages.  Set during Login.
  212. <P></P>
  213. <DT><STRONG><A NAME="item_Message"><EM>Message</EM></A></STRONG><BR>
  214. <DD>
  215. The last status message received from the server.
  216. <P></P>
  217. <DT><STRONG><A NAME="item_State"><EM>State</EM></A></STRONG><BR>
  218. <DD>
  219. The internal state of the connection: DEAD, AUTHORIZATION, TRANSACTION.
  220. <P></P>
  221. <DT><STRONG><A NAME="item_POPStat"><EM>POPStat</EM></A></STRONG><BR>
  222. <DD>
  223. Return the results of a POP3 STAT command.  Sets the size of the
  224. mailbox.
  225. <P></P>
  226. <DT><STRONG><A NAME="item_List"><EM>List</EM></A></STRONG><BR>
  227. <DD>
  228. Return a list of sizes of each message.
  229. <P></P>
  230. <DT><STRONG><A NAME="item_ListArray"><EM>ListArray</EM></A></STRONG><BR>
  231. <DD>
  232. Return a list of sizes of each message.  This returns an indexed
  233. array, with each message number as an index (starting from 1) and the
  234. value as the next entry on the line.  Beware that some servers send
  235. additional info for each message for the list command.  That info may
  236. be lost.
  237. <P></P>
  238. <DT><STRONG><A NAME="item_Uidl"><EM>Uidl</EM>( [MESSAGE_NUMBER] )</A></STRONG><BR>
  239. <DD>
  240. Return the unique ID for the given message (or all of them).  Returns
  241. an indexed array with an entry for each valid message number.
  242. Indexing begins at 1 to coincide with the server's indexing.
  243. <P></P>
  244. <DT><STRONG><A NAME="item_Last"><EM>Last</EM></A></STRONG><BR>
  245. <DD>
  246. Return the number of the last message, retrieved from the server.
  247. <P></P>
  248. <DT><STRONG><A NAME="item_Reset"><EM>Reset</EM></A></STRONG><BR>
  249. <DD>
  250. Tell the server to unmark any message marked for deletion.
  251. <P></P>
  252. <DT><STRONG><A NAME="item_User"><EM>User</EM>( [USER_NAME] )</A></STRONG><BR>
  253. <DD>
  254. Set/Return the current user name.
  255. <P></P>
  256. <DT><STRONG><A NAME="item_Pass"><EM>Pass</EM>( [PASSWORD] )</A></STRONG><BR>
  257. <DD>
  258. Set/Return the current user name.
  259. <P></P>
  260. <DT><STRONG><A NAME="item_Login"><EM>Login</EM></A></STRONG><BR>
  261. <DD>
  262. Attempt to login to the server connection.
  263. <P></P>
  264. <DT><STRONG><A NAME="item_Host"><EM>Host</EM>( [HOSTNAME] )</A></STRONG><BR>
  265. <DD>
  266. Set/Return the current host.
  267. <P></P>
  268. <DT><STRONG><A NAME="item_Port"><EM>Port</EM>( [PORT_NUMBER] )</A></STRONG><BR>
  269. <DD>
  270. Set/Return the current port number.
  271. <P></P></DL>
  272. <P>
  273. <HR>
  274. <H1><A NAME="author">AUTHOR</A></H1>
  275. <P>Sean Dowd <<A HREF="mailto:pop3client@dowds.net">pop3client@dowds.net</A>></P>
  276. <P>
  277. <HR>
  278. <H1><A NAME="credits">CREDITS</A></H1>
  279. <P>Based loosely on News::NNTPClient by Rodger Anderson
  280. <<A HREF="mailto:rodger@boi.hp.com">rodger@boi.hp.com</A>>.</P>
  281. <P>
  282. <HR>
  283. <H1><A NAME="see also">SEE ALSO</A></H1>
  284. <P>perl(1).</P>
  285. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  286. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  287. <STRONG><P CLASS=block> Mail::POP3Client - Perl 5 module to talk to a POP3 server</P></STRONG>
  288. </TD></TR>
  289. </TABLE>
  290.  
  291. </BODY>
  292.  
  293. </HTML>
  294.