Professional Documents
Culture Documents
Candidates Declaration
I hereby declare that the work presented in this project entitled
“LucidMail - POP3/SMTP/IMAP4 Mail API”, submitted towards
completion of Mini Project in 6th Semester of B.Tech (I.T) at Indian
Institute of Information Technology, Allahabad is an authentic
record of my work carried out under guidance of Dr. Hema Bindu.
Saumitra Agarwal
(2001199)
May 18, 2004
Certificate
Table of Contents
TABLE OF CONTENTS..................................................................................3
ABSTRACT.....................................................................................................4
ACKNOWLEDGEMENT.................................................................................5
INTRODUCTION.............................................................................................6
DESIGN CRITERIA.........................................................................................8
IMPLEMENTATION......................................................................................10
IMPLEMENTATION......................................................................................14
IMPLEMENTATION......................................................................................15
IMPLEMENTATION......................................................................................16
PLATES.........................................................................................................18
PLATES.........................................................................................................19
REFERENCES.............................................................................................20
APPENDIX....................................................................................................21
APPENDIX....................................................................................................22
4
Abstract
LucidMail is a simple yet comprehensive Java based Mail API. It
can be used for both sending and retrieving Emails. LucidMail uses
SMTP (Simple Mail Transfer Protocol, RFC 2821) for sending
Emails. It supports POP3 (Post Office Protocol 3, RFC 1939) and
IMAP4 (Internet Message Access Protocol - Version 4rev1, RFC
3501) protocols and either can be used for retrieving Emails,
depending upon the server support.
The utility of LucidMail lies in the fact that it is purely Java based.
Therefore, it can be used on any platform for which a Java Virtual
Machine is available. As of now, it has been tested over Windows
XP and Linux (RH8, RH9).
5
Acknowledgement
Saumitra Agarwal
Tuesday, May 18, 2004
6
Introduction
Simple Mail Transfer Protocol (SMTP)
The Internet standard protocol for transferring electronic mail
messages from one computer to another. SMTP specifies how two
mail systems interact and the format of control messages they
exchange to transfer mail. Specified by RFC 2821.
• Microsoft Windows:
o Microsoft Outlook Express
o Eudora
o Pegasus Mail
• Linux:
o Kmail
o Pine
Apart from Pine, which is a text based MUA, rest of the Email
Clients provide a Graphical User Interface. Though these clients
are quite powerful, and implement most of the POP3 and IMAP4
specifications, they are all tied to a specific platform. That is to
say, that Microsoft Outlook Express runs only on Microsoft
Windows and Kmail runs only on Linux. This creates a problem for
users (like me), who use different Operating Systems on a day to
day basis. Such users have to use/purchase different Email Clients
for different Operating Systems. LucidMail is a pure Java solution
to this problem. It can be used to develop platform independent
Email Clients in Java programming language.
8
Design Criteria
The design of LucidMail is such that the API and the Client
application are not tied together. From a programmer’s point of
view, this means that the API can be used as a building block for
creating a completely different and more robust Email application.
LucidMail client is hence a simple Swing based Email client,
developed with the sole purpose of demonstrating the power of
LucidMail API.
LucidMail API
10
Implementation
LucidMail layered architecture
The Abstract Layer declares classes, interfaces and abstract
methods intended to support mail handling functions that all mail
systems support. These elements are subclassed and extended to
interface with message access and message transport protocols as
necessary. This layer includes classes such as Address, Transport,
Connection, TransportListener etc.
Implementation
Implementation
Implementation
Implementation
SMTP
The SMTPTransport class is a Transport implementation that
conforms to RFC 0821, and RFC 2821. The supported commands
are
• DATA
• EHLO
• HELO
• HELP
• MAIL
• NOOP
• QUIT
• RCPT
• RSET
• From
• To
• Cc
• Bcc
• Reply-To
• Date
• Subject
Rest of the headers (like Received), are set by the Mail Transfer
Agent.
15
Implementation
POP3
The POP3Account class is a POP3 store implementation and it
conforms to RFC 1939. The supported commands are:
• AUTHERIZATION State
o QUIT
• TRANSACTION State
o STAT
o LIST
o RETR
o DELE
o RSET
• UPDATE State
o QUIT
• Optional Commands
o USER
o PASS
o APOP
Implementation
IMAP4
The IMAP4Account class is a IMAP4 store implementation and it
conforms to RFC 3501. The supported commands are:
User User
UA UA
(RottenMail Client) (LucidMail Client)
SMTP MTA
MTA (mail.iiita.ac.in)
(mx1.mail.yahoo.com)
SMTP SMTP
SMTP
MTA MTA
(mx1.mail.yahoo.com) (mx1.mail.yahoo.com)
18
Plates
Screenshot 1: LucidMail Client (Windows XP
Look)
The active window is the one for sending mails. Background shows
the INBOX.
19
Plates
Screenshot 2: New Message window (Java
look)
Clicking the Send button sends the message
20
References
1. J. Klensin - “Simple Mail Transfer Protocol”, RFC 2821
2. Jonathan B. Postel – “Simple Mail Transfer Protocol”, RFC
821
3. David H. Crocker - “Standard For The Format Of Arpa
Internet Text Messages”, RFC 822
4. J. Myers – “SMTP Service Extension for Authentication”, RFC
2554
5. J. Myers, M. Rose - “Post Office Protocol - Version 3”, RFC
1939
6. J. Klensin, R. Catoe, P. Krumviede - “IMAP/POP AUTHorize
Extension for Simple Challenge/Response”, RFC 2195
7. R. Rivest - “The MD5 Message-Digest Algorithm”, RFC 1321
8. M. Horowitz , S. Lunt - “FTP Security Extensions”, RFC 2228
9. http://java.sun.com/reference/api/index.html
21
Appendix
Sample SMTP Session
S: 220 mail.iiita.ac.in ESMTP
C: EHLO CF335
S: 250-mail.iiita.ac.in
S: 250-AUTH LOGIN PLAIN
S: 250-AUTH=LOGIN PLAIN
S: 250-STARTTLS
S: 250-PIPELINING
S: 250 8BITMIME
C: MAIL FROM: <Saumitra <saumitra@gmail.com>>
S: 250 ok
C: RCPT TO: <saumitra@iiita.ac.in>
S: 250 ok
C: RCPT TO: <montoo@iiita.ac.in>
S: 250 ok
C: DATA
S: 354 go ahead
C: From:Saumitra <saumitra@gmail.com>
C: To:saumitra@iiita.ac.in
C: Bcc:montoo@iiita.ac.in
C: Date:19 May 2004 00:53:27 +0100
C: Subject:Test Mail
C:
C: Hi,
C: the first test mail. Lets see it the Bcc header is transferred
or not.
C: regards,
C: Saumitra
C: .
S: 250 ok 1084907737 qp 2081
C: QUIT
S: 221 mail.iiita.ac.in
22
Appendix