Goals

jocundmail
Class MailReader

java.lang.Object
  extended by jocundmail.MailReader

public class MailReader
extends java.lang.Object

This is a class to facilitate mail server communication. At the moment it supports only POP communication, with plain text authentication. It should be expanded to other protocols and authentication types.

Version:
0.4.0
Author:
J.J. Sestrich
Goals:
0.4.0 Basic implementation for intial testing.DONE!
0.8.0 New Mail Detection
1.0.0 First release version - More specifics to come.
Todo:
Progress:
(5/28/07) There is a very basic implementation that supports plain text AUTH and then a few ways of retrievign messages from the server.

Field Summary
 boolean box_dirty
          At the moment public, but will probably be changed to be protected
 int dirty_count
          At the moment public, but will probably be changed to be protected
 int dirty_size
          At the moment public, but will probably be changed to be protected
 java.io.BufferedReader inbuf
          At the moment public, but will probably be changed to be protected
 java.io.InputStream istream
          At the moment public, but will probably be changed to be protected
 java.net.Socket mail_serv
          At the moment public, but will probably be changed to be protected
 java.io.OutputStream ostream
          At the moment public, but will probably be changed to be protected
 java.io.BufferedWriter outbuf
          At the moment public, but will probably be changed to be protected
 int total_count
          At the moment public, but will probably be changed to be protected
 int total_size
          At the moment public, but will probably be changed to be protected
 
Constructor Summary
MailReader(java.lang.String mail_host)
          Attempts to start a mail reading session with the host supplied.
 
Method Summary
 void close()
          Closes the connection with the server.
 java.lang.String list()
          POP - list command
 boolean login(java.lang.String user, java.lang.String pass)
          Logs into the server using plain text AUTH, and given credentials
static void main(java.lang.String[] args)
          A test program for this class
 int readMail()
          No Implementation
 byte[] retr_byte(int i)
          POP - retr command -- might not work
 void retr_test(int msg)
          A debugging function...has some additional info when downloading the message from the server, as well as prints out the message in byte array form.
 java.lang.String retr(int i)
          POP - Retr command...I won't garuntee this works...
 void retr(int i, java.io.File file)
          POP - retr command -- best solution Downloads the message from the server into File supplied
 void sendLine(java.lang.String line)
          Sends a line to the server after appending "\r\n"
 java.lang.String stat()
          POP - Stat command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

total_count

public int total_count
At the moment public, but will probably be changed to be protected


total_size

public int total_size
At the moment public, but will probably be changed to be protected


dirty_count

public int dirty_count
At the moment public, but will probably be changed to be protected


dirty_size

public int dirty_size
At the moment public, but will probably be changed to be protected


box_dirty

public boolean box_dirty
At the moment public, but will probably be changed to be protected


mail_serv

public java.net.Socket mail_serv
At the moment public, but will probably be changed to be protected


istream

public java.io.InputStream istream
At the moment public, but will probably be changed to be protected


ostream

public java.io.OutputStream ostream
At the moment public, but will probably be changed to be protected


inbuf

public java.io.BufferedReader inbuf
At the moment public, but will probably be changed to be protected


outbuf

public java.io.BufferedWriter outbuf
At the moment public, but will probably be changed to be protected

Constructor Detail

MailReader

public MailReader(java.lang.String mail_host)
Attempts to start a mail reading session with the host supplied. If a port is not given, 110 is assumed.

Parameters:
mail_host - Should be a host in host:port form.
Method Detail

close

public void close()
Closes the connection with the server.


sendLine

public void sendLine(java.lang.String line)
Sends a line to the server after appending "\r\n"

Parameters:
line - Line to send to the server

login

public boolean login(java.lang.String user,
                     java.lang.String pass)
Logs into the server using plain text AUTH, and given credentials

Parameters:
user - Username to login with
pass - Password to login with

stat

public java.lang.String stat()
POP - Stat command

Returns:
The response from the server.

retr

public java.lang.String retr(int i)
POP - Retr command...I won't garuntee this works...

Parameters:
i - The index of the message on the server
Returns:
The message in String form.

retr_test

public void retr_test(int msg)
A debugging function...has some additional info when downloading the message from the server, as well as prints out the message in byte array form.

Parameters:
msg - Index of the message on the server

retr_byte

public byte[] retr_byte(int i)
POP - retr command -- might not work

Parameters:
i - The index of the message on the server
Returns:
The message in byte array form

retr

public void retr(int i,
                 java.io.File file)
POP - retr command -- best solution Downloads the message from the server into File supplied

Parameters:
i - The index of the message on the server
file - The file the message is to be saved to.

list

public java.lang.String list()
POP - list command

Returns:
The server response in String form

readMail

public int readMail()
No Implementation


main

public static void main(java.lang.String[] args)
A test program for this class

Parameters:
args - Retrieves index args[0]

SourceForge.net Logo