com.java4less.rmail
Class PopServer

java.lang.Object
  |
  +--com.java4less.rmail.PopServer

public class PopServer
extends java.lang.Object

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

Example:

pop.connect("pop.mycompany.com","user","pwd");  // Connect
for (int i=1;i<=pop.msgs;i++) {    // iterate on number of messages
   MailMsg m=pop.retrieveMsg(i);             // get message
   pop.deleteMsg(i);                    // delete message

   // do here whatever you like with the MailMsg object (variable m)
}
pop.disconnect();                       // disconnect

 


Field Summary
 boolean debug
          if true, the class will generate debug messages in the java console.
 ProgressSMTPListener liste
          This listener receives the status of the connection when it changes, it sould only be used for feedback (visualization) purposes.
 java.lang.String msgFile
          The file where the received message will be stored.
 int msgs
          number of messages in the mailbox.
 boolean parseOnLine
           
 int popPort
          POP port.
 
Constructor Summary
PopServer()
           
 
Method Summary
 boolean connect(java.lang.String serverAdd, java.lang.String userName, java.lang.String userPwd)
          connects and gets the number of messages in the mailbox.
 boolean deleteMsg(int num)
          delete a message in the mailbox.
 boolean disconnect()
          disconnects from the server.
 long getSizeMsg(int num)
          returns the size in bytes of the message.
 MailMsg parseFromFile(java.lang.String f)
           
 MailMsg parseMsg(boolean WeAreInPart, MailMsgPart parentPart)
          internal use.
 MailMsg 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.

liste

public ProgressSMTPListener liste
This listener receives the status of the connection when it changes, it sould only be used for feedback (visualization) purposes.

msgs

public int msgs
number of messages in the mailbox. This value is available after connection.

msgFile

public java.lang.String msgFile
The file where the received message will be stored. This is used for debugging purposes.

parseOnLine

public boolean parseOnLine

debug

public boolean debug
if true, the class will generate debug messages in the java console.
Constructor Detail

PopServer

public PopServer()
Method Detail

connect

public boolean connect(java.lang.String serverAdd,
                       java.lang.String userName,
                       java.lang.String userPwd)

connects and gets the number of messages in the mailbox. The parameters are, the server address (e.g. pop.mycompany.com, the user name and the password).

 


parseFromFile

public MailMsg parseFromFile(java.lang.String f)

retrieveMsg

public MailMsg retrieveMsg(int num)
retrieves a message from the mailbox.

parseMsg

public MailMsg parseMsg(boolean WeAreInPart,
                        MailMsgPart parentPart)
internal use. It is used to parse the mime content of a message or part.

getSizeMsg

public long getSizeMsg(int num)
returns the size in bytes of the message.

deleteMsg

public boolean deleteMsg(int num)
delete a message in the mailbox.

disconnect

public boolean disconnect()
disconnects from the server.