biz.wisesoft.util.mail
Class PopClient

java.lang.Object
  extended bybiz.wisesoft.util.mail.PopClient

public class PopClient
extends java.lang.Object

The POP client class is used to retrieve messages from a POP3 server. It returns one object of type EmailMessage for each message in the mailbox.
Example:

 // Connect
 pop.connect("pop.aba.com","username","pasword"); 
 // iterate on number of messages
 for (int i=1;i<=pop.numberMessages;i++) {    
  // get message
  EnailMessage emailMessage=pop.retrieveMsg(i);  
  // delete message
  pop.deleteMsg(i);                    
 }  
 // disconnect 
  pop.disconnect();      
 


Field Summary
 boolean debug
          if true, the class will generate debug messages
 biz.wisesoft.util.mail.JvInterface jvint
           
 java.lang.String msgFile
          The file where the received message will be stored.
 int numberMessages
          number of messages in the mailbox.
 int popPort
          POP port.
 
Constructor Summary
PopClient()
          The default Constructor
 
Method Summary
 boolean connect(java.lang.String serverAdd, java.lang.String userName, java.lang.String userPwd)
          Connects the Pop3 server
 boolean deleteMsg(int num)
          Deletes an email from the mailbox
 boolean disconnect()
          Disconnects from the server.
 long getSizeMsg(int num)
          Returns the size of the email
 EmailMessage retrieveMsg(int num)
          Retrieves a message from the mailbox.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

popPort

public int popPort
POP port. The default is 110.


jvint

public biz.wisesoft.util.mail.JvInterface jvint

numberMessages

public int numberMessages
number of messages in the mailbox.


msgFile

public java.lang.String msgFile
The file where the received message will be stored.


debug

public boolean debug
if true, the class will generate debug messages

Constructor Detail

PopClient

public PopClient()
The default Constructor

Method Detail

connect

public boolean connect(java.lang.String serverAdd,
                       java.lang.String userName,
                       java.lang.String userPwd)
Connects the Pop3 server

Parameters:
serverAdd - Pop3 Server address
userName - The username of email account
userPwd - The password of email account
Returns:
Whether connects or not

retrieveMsg

public EmailMessage retrieveMsg(int num)
Retrieves a message from the mailbox.

Parameters:
num - The id of the email
Returns:
The email message

getSizeMsg

public long getSizeMsg(int num)
Returns the size of the email

Parameters:
num - The id of the email
Returns:
The size of the email

deleteMsg

public boolean deleteMsg(int num)
Deletes an email from the mailbox

Parameters:
num - The email id
Returns:
Whether deletes the email or not

disconnect

public boolean disconnect()
Disconnects from the server.

Returns:
Whether disconnects or not