Class POP3Client() Professional

Class function of the POP3Client class.


Instances of the POP3Client class are used to access a POP3 server using the Post Office Protocol Version 3. This communication protocol is used to retrieve e-mail messages from a mail server.

A POP3Client connects via the TCP/IP network protocol to an e-mail server and then negotiates the parameters for retrieving messages. This so-called POP3 handshake is performed when the method :connect(). is executed.

By default, e-mails are transferred unencrypted as human-readable data. However, the POP3Client class also supports establishing connections where all communication is encrypted via a Secure Socket Layer (SSL). See the method :new() for more details on setting up secure connections.

Class methods
Creates an instance of the POP3Client class.
Methods for retrieving e-mails
Connects to the POP3 server.
Checks if a connection is established
Deletes an e-mail message on the POP3 server.
Disconnects from the POP3 server.
Retrieves an e-mail message from the POP3 server.
Retrieves an e-mail message from the POP3 server as a character string.
Returns the number of messages available in the mail account.
Unmark all messages which are marked as deleted.
Retrieve the number of bytes on the POP3 server.
Retrieves the identifiers and message numbers of all messages on the POP3 server.
Retrieves the sizes and message numbers of all messages on the POP3 server.
Configures secure communication with the server.
Set the timeout value for communication with the POP3 server.
Get the timeout value for communication with the POP3 server.
Return the Header of a Message.
Return the Header of a Message.
Set a code block for progress evaluation
Returns the numeric value of the last error
Retrieving e-mails via SSL
// The example explains how to access a POP3 server 
// for e-mail retrieval. The pending e-mails are 
// retrieved from a mailbox in the FOR..NEXT loop. 
// Limited e-mail data is then displayed, i.e. the 
// e-mail of the sender ("From:" header) and the 
// subject line ("Subject:" header) are listed. 
// Refer to the classes MIMEContent(), MailAddress() 
// and MIMEMessage() for additional examples. 

#pragma library("asinet10.lib") 

   LOCAL oLog 
   LOCAL oPOP3, i, nCount 
   LOCAL oMail, oSender, cSubject 

   oLog := LogWriter():new() 

   // Connect to the Windows Live POP3 server. 
   // Port number 995 implies a secure SSL 
   // connection. Use standard port 110 for 
   // unencrypted communication and for servers 
   // which do not support SSL. 
   oPop3 := POP3Client():new( "", 995         , ; 
                              "", ; 
                              "0924LargeCat"               , ; 
                              oLog, 2 ) 
   IF .NOT. oPOP3:connect() 
      ? "Unable to establish connection" 

   nCount := oPOP3:getNumberOfNewMessages() 

   FOR i := 1 TO nCount 
      // Obtain MIMEMessage object for e-mail 
      oMail := oPOP3:getMessage( i ) 

      // Obtain MailAddress object of sender 
      oSender := oMail:getFrom() 
      IF .NOT. Empty( oSender ) 
         ? "From:", oSender:getString() 
         ? "Unknown sender" 

      // Subject line of e-mail 
      cSubject := oMail:getSubject() 
      IF .NOT. Empty( cSubject ) 
         ? "Subject:", cSubject 
         ? "Unknown subject" 



 * User-defined class for log-data processing 
CLASS LogWriter 
   INLINE METHOD write( cLogData ) 
      ? cLogData 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.