Mail Server Project Report

49
Java Mail Server Abstract The project “Java Mail server” is divided in to three modules i.e Server module, Client Module, Email Inbox module. Server accepts the connection from different clients through server socket class and all the details regarding client connection establishment , sending, receiving and termination is stored in the server . Clients can connect to the server when server is active, Each client can send and receive mails, attachment to other clients. Clients user name and passwords are stored in data files, Email inbox module handles all the functions related mails like mail forwarding, view attachment, save attachment or mail etc. This Project also provides threading support automatically, which handles the socket connection and disconnection to a peer. It supports both client and server sockets. A server socket can be referred as to a socket that can accept many connections. And a client socket is a socket that is connected to server socket.

Transcript of Mail Server Project Report

Page 1: Mail Server Project Report

Java Mail Server Abstract

The project “Java Mail server” is divided in to three modules i.e Server module, Client Module,

Email Inbox module. Server accepts the connection from different clients through server socket

class and all the details regarding client connection establishment , sending, receiving and

termination is stored in the server . Clients can connect to the server when server is active, Each

client can send and receive mails, attachment to other clients.

Clients user name and passwords are stored in data files, Email inbox module handles all the

functions related mails like mail forwarding, view attachment, save attachment or mail etc. This

Project also provides threading support automatically, which handles the socket connection and

disconnection to a peer. It supports both client and server sockets. A server socket can be

referred as to a socket that can accept many connections. And a client socket is a socket that is

connected to server socket.

Page 2: Mail Server Project Report

Table of Contents

S. no

Topic Page No.

1 Certificate -

2 Acknowledgements -

3 List of Tables/Figures/Symbols -

4 Chapter-1: Introduction

5 Chapter-2: System Requirements Analysis

6 Chapter-3: System Design

7 Chapter-4: System Development

8 Chapter-5: Summary and Conclusions

9 References/Bibliography

Page 3: Mail Server Project Report

1. Introduction1.1 Socket Programming

Internet and WWW have emerged as global ubiquitous media for communication and changed

the way we conduct science, engineering, and commerce. They are also changing the way we

learn, live, enjoy, communicate, interact, engage, etc. The modern life activities are getting

completely centered around or driven by the Internet.

To take advantage of opportunities presented by the Internet, businesses are continuously

seeking new and innovative ways and means for offering their services via the Internet. This

created a huge demand for software designers and engineers with skills in creating new Internet-

enabled applications or porting existing/legacy applications to the Internet platform. The key

elements for developing Internet-enabled applications are a good understanding of the issues

involved in implementing distributed applications and sound knowledge of the fundamental

network programming models.

Client/Server Communication

At a basic level, network-based systems consist of a server , client , and a media for

communication. computer running a program that makes a request for services is called client

machine. A computer running a program that offers requested services from one or more clients

is called server machine. The media for communication can be wired or wireless network.

Generally, programs running on client machines make requests to a program (often called as

server program) running on a server machine. They involve networking services provided by the

transport layer, which is part of the Internet software stack, often called TCP/IP (Transport

Control Protocol/Internet Protocol) stack, shown in Fig. 13.2. The transport layer comprises two

Page 4: Mail Server Project Report

types of protocols, TCP (Transport Control Protocol) and UDP (User Datagram Protocol). The

most widely used programming interfaces for these protocols are sockets.

TCP is a connection-oriented protocol that provides a reliable fl ow of data between two

computers. Example applications that use such services are HTTP, FTP, and Telnet.

UDP is a protocol that sends independent packets of data, called datagrams, from one computer

to another with no guarantees about arrival and sequencing. Example applications that use such

services include Clock server and Ping.

The TCP and UDP protocols use ports to map incoming data to a particular process running on a

computer. Port is represented by a positive (16-bit) integer value. Some ports have been reserved

to support common/well known services:

ftp 21/tcp

telnet 23/tcp

smtp 25/tcp

login 513/tcp

http 80/tcp,udp

https 443/tcp,udp

User-level process/services generally use port number value >= 1024

Server Socket Class: The java.net.ServerSocket class is used by server applications to obtain a port and listen for client requests

The ServerSocket class has four constructors:

SN Methods with Description

1

public ServerSocket(int port) throws IOExceptionAttempts to create a server socket bound to the specified port. An exception occurs if the port is already bound by another application.

2

public ServerSocket(int port, int backlog) throws IOExceptionSimilar to the previous constructor, the backlog parameter specifies how many incoming clients to store in a wait queue.

Page 5: Mail Server Project Report

3

public ServerSocket(int port, int backlog, InetAddress address) throws IOExceptionSimilar to the previous constructor, the InetAddress parameter specifies the local IP address to bind to. The InetAddress is used for servers that may have multiple IP addresses, allowing the server to specify which of its IP addresses to accept client requests on

4

public ServerSocket() throws IOExceptionCreates an unbound server socket. When using this constructor, use the bind() method when you are ready to bind the server socket

Socket Class Methods:

The java.net.Socket class represents the socket that both the client and server use to

communicate with each other. The client obtains a Socket object by instantiating one, whereas

the server obtains a Socket object from the return value of the accept() method.

The Socket class has five constructors that a client uses to connect to a server:

SN Methods with Description

1

public Socket(String host, int port) throws UnknownHostException, IOException.This method attempts to connect to the specified server at the specified port. If this constructor does not throw an exception, the connection is successful and the client is connected to the server.

2

public Socket(InetAddress host, int port) throws IOExceptionThis method is identical to the previous constructor, except that the host is denoted by an InetAddress object.

3

public Socket(String host, int port, InetAddress localAddress, int localPort) throws IOException.Connects to the specified host and port, creating a socket on the local host at the specified address and port.

4

public Socket(InetAddress host, int port, InetAddress localAddress, int localPort) throws IOException.This method is identical to the previous constructor, except that the host is denoted by an InetAddress object instead of a String

5 public Socket()Creates an unconnected socket. Use the connect() method to connect this socket

Page 6: Mail Server Project Report

to a server.

When the Socket constructor returns, it does not simply instantiate a Socket object but it actually attempts to connect to the specified server and port.

Some methods of interest in the Socket class are listed here. Notice that both the client and server have a Socket object, so these methods can be invoked by both the client and server.

SN Methods with Description

1

public void connect(SocketAddress host, int timeout) throws IOExceptionThis method connects the socket to the specified host. This method is needed only when you instantiated the Socket using the no-argument constructor.

2

public InetAddress getInetAddress()This method returns the address of the other computer that this socket is connected to.

3public int getPort()Returns the port the socket is bound to on the remote machine.

4public int getLocalPort()Returns the port the socket is bound to on the local machine.

5public SocketAddress getRemoteSocketAddress()Returns the address of the remote socket.

6

public InputStream getInputStream() throws IOExceptionReturns the input stream of the socket. The input stream is connected to the output stream of the remote socket.

7

public OutputStream getOutputStream() throws IOExceptionReturns the output stream of the socket. The output stream is connected to the input stream of the remote socket

8

public void close() throws IOExceptionCloses the socket, which makes this Socket object no longer capable of connecting again to any server

1.2 Email Server Architecture

The mail server infrastructure consists of several components that work together to send, relay, receive, store, and deliver email.

Page 7: Mail Server Project Report

The mail server workload uses the following Internet standard protocols for sending and retrieving email:

Simple Mail Transfer Protocol (SMTP): the Internet standard protocol for sending email.

Post Office Protocol (POP): an Internet standard protocol for retrieving email.

Internet Message Access Protocol version 4 (IMAPv4): an Internet standard protocol for retrieving email.

A Simple E-mail Server: Working

Given that you have an e-mail client on your machine, you are ready to send and receive e-mail.

All that you need is an e-mail server for the client to connect to. Let's imagine what the simplest

possible e-mail server would look like in order to get a basic understanding of the process. Then

we will look at the real thing.

If you've read How Web Servers Work, then you know that machines on the Internet can run

email application  that act as servers. There are Web Server FTP servers, telnet servers and e-

mail servers running on millions of machines on the Internet right now. These applications run

all the time on the server machine and they listen to specific ports, waiting for people or

programs to attach to the port. The simplest possible e-mail server would work something like

this:

1. It would have a list of e-mail accounts, with one account for each person who can receive e-mail

on the server. My account name might be mbrain, John Smith's might be jsmith, and so on.

Page 8: Mail Server Project Report

2. It would have a text file for each account in the list. So, the server would have a text file in its

directory named MBRAIN.TXT, another named JSMITH.TXT, and so on.

3. If someone wanted to send me a message, the person would compose a text

messages  ("Marshall, Can we have lunch Monday? John") in an e-mail client, and indicate that

the message should go to mbrain. When the person presses the Send button, the e-mail client

would connect to the e-mail server and pass to the server the name of the recipient (mbrain), the

name of the sender (jsmith) and the body of the message.

4. The server would format those pieces of information and append them to the bottom of the

MBRAIN.TXT file. The entry in the file might look like this:

From: jsmith To: mbrain Marshall, Can we have lunch Monday? John

Real Time Email Server

For the vast majority of people right now, the real e-mail system consists of two different servers

running on a server machine. One is called the SMTP server, where SMTP stands for Simple

Mail Transfer Protocol. The SMTP server handles outgoing mail. The other is either a POP3

server or an IMAP server, both of which handle incoming mail. POP stands for Post Office

Protocol, and IMAP stands for Internet Mail Access Protocol.

Page 9: Mail Server Project Report

The SMTP server listens on well-known port number 25, POP3 listens on port 110 and IMAP

uses port 143 

1.3 Introduction to Project “Java Mail Server”

Introduction

This project “Java Mail server “ is about a client/server multi-threaded socket class, which helps

The thread is optional since the developer is still responsible to decide if needs it. There are other

Socket classes here and other places over the Internet but none of them can provide feedback

(event detection) to your application like this one does. It provides you with the following events

detection: connection established, connection dropped, connection failed and data reception

(including 0 byte packet).

Description

Java Mail Server provides threading support automatically for you, which handles the socket

connection and disconnection to a peer. It also features some options not yet found in any socket

classes that I have seen so far. It supports both client and server sockets. A server socket can be

referred as to a socket that can accept many connections. And a client socket is a socket that is

connected to server socket. You may still use this class to communicate between two

applications without establishing a connection. In the latter case, you will want to create two

UDP server sockets (one for each application). This class also helps reduce coding need to create

chat-like applications and IPC (Inter-Process Communication) between two or more applications

(processes). Reliable communication between two peers is also supported with TCP/IP with error

handling. You may want to use the smart addressing operation to control the destination of the

data being transmitted (UDP only). TCP operation of this class deals only with communication

between two peers.

Analysis of Network Client Server

Page 10: Mail Server Project Report

TCP/IP stack

The TCP/IP stack is shorter than the OSI one:

TCP is a connection-oriented protocol; UDP (User Datagram Protocol) is a connectionless

protocol.

IP datagram’s

The IP layer provides a connectionless and unreliable delivery system. It considers each

datagram independently of the others. Any association between datagram must be supplied by

the higher layers. The IP layer supplies a checksum that includes its own header. The header

includes the source and destination addresses. The IP layer handles routing through an Internet. It

is also responsible for breaking up large datagram into smaller ones for transmission and

reassembling them at the other end.

Page 11: Mail Server Project Report

UDP

UDP is also connectionless and unreliable. What it adds to IP is a checksum for the contents of

the datagram and port numbers. These are used to give a client/server model - see later.

TCP

TCP supplies logic to give a reliable connection-oriented protocol above IP. It provides a virtual

circuit that two processes can use to communicate.

Internet addresses

In order to use a service, you must be able to find it. The Internet uses an address scheme for

machines so that they can be located. The address is a 32 bit integer which gives the IP address.

This encodes a network ID and more addressing. The network ID falls into various classes

according to the size of the network address.

Network address

Class A uses 8 bits for the network address with 24 bits left over for other addressing. Class B

uses 16 bit network addressing. Class C uses 24 bit network addressing and class D uses all 32.

Subnet address

Internally, the UNIX network is divided into sub networks. Building 11 is currently on one sub

network and uses 10-bit addressing, allowing 1024 different hosts.

Host address

8 bits are finally used for host addresses within our subnet. This places a limit of 256 machines

that can be on the subnet.

Page 12: Mail Server Project Report

Total address

The 32 bit address is usually written as 4 integers separated by dots.

Port addresses

A service exists on a host, and is identified by its port. This is a 16 bit number. To send a

message to a server, you send it to the port for that service of the host that it is running on. This

is not location transparency! Certain of these ports are "well known".

Sockets

A socket is a data structure maintained by the system to handle network connections. A socket is

created using the call socket. It returns an integer that is like a file descriptor. In fact, under

Windows, this handle can be used with ReadFile and WriteFile functions.

#include <sys/types.h>

#include <sys/socket.h>

int socket(int family, int type, int protocol);

Here "family" will be AF_INET for IP communications, protocol will be zero, and type will

depend on whether TCP or UDP is used. Two processes wishing to communicate over a network

create a socket each. These are similar to two ends of a pipe - but the actual pipe does not yet

exist.

Page 13: Mail Server Project Report

2. System Requirement Analysis

2.1 Introduction: The project “Java Mail server” is divided in to three modules i.e Server

module, Client Module, Email Inbox module. Server accepts the connection from different

clients through server socket class and all the details regarding client connection establishment ,

sending, receiving and termination is stored in the server . Clients can connect to the server when

server is active, Each client can send and receive mails, attachment to other clients.

Clients user name and passwords are stored in data files, Email inbox module handles all the

functions related mails like mail forwarding, view attachment, save attachment or mail etc. This

Project also provides threading support automatically, which handles the socket connection and

disconnection to a peer. It supports both client and server sockets. A server socket can be

referred as to a socket that can accept many connections. And a client socket is a socket that is

connected to server socket.

2.2 Software Requirement:

Language: Java

Platform: Netbeans IDE

Tool: Jdk 1.7

Client: Own Client designed Using Java Socket.

Server: Server designed Using Java Server Socket

Page 14: Mail Server Project Report

Hardware Requirement:

RAM: 128MB (Minimum).

Processor: Pentium 2 and above.

Processor Speed: Above 500 MHz.

2.3 Functional Requirement

Transmitting Message and Files between Client and Server.

The data will be valid until the Server is Valid.

Everything defined as Object oriented.

Server has been developed using Server Socket programming in Java.

Client has been developed using Socket Programming.

Transmitting data between Client and Server has been developed IP address.

We are running it as Server Client in PC itself.

We can convert it to internet server and client processing by implementing POP3 protocol and SMTP server.

We have Used Data file to store username, password and mails.

Usage of Sql Server will not be needed for sending Messages and attachments.

Page 15: Mail Server Project Report

2.4 Non- Functional Requirement:

All IT systems at some point in their lifecycle need to consider non-functional requirements and

their testing. For some projects these requirements warrant extensive work and for other project

domains a quick check through may be sufficient. As a minimum, the following list can be a

helpful reminder to ensure you have covered the basics.  Based on your own project

characteristics, I would recommend the topics are converted into SMART (Specific, Measurable,

Attainable, Realisable, Timeboxed / Traceable) requirements with the detail and rigour

appropriate to your project.

The list is also available at the bottom of the article as a one-page PDF document. While it is

easy to make the list longer by adding more items, I would really like to hear how to make the

list better while keeping it on one page (and readable) to share with other visitors here.

Security

  • Login requirements - access levels, CRUD levels

  • Password requirements - length, special characters, expiry, recycling policies

  • Inactivity timeouts – durations, actions

Audit

  • Audited elements – what business elements will be audited?

  • Audited fields – which data fields will be audited?

  • Audit file characteristics - before image, after image, user and time stamp, etc

Performance

  • Response times - application loading, screen open and refresh times, etc

  • Processing times – functions, calculations, imports, exports

  • Query and Reporting times – initial loads and subsequent loads 

Capacity

  • Throughput – how many transactions per hour does the system need to be able to handle?

Page 16: Mail Server Project Report

  • Storage – how much data does the system need to be able to store?

  • Year-on-year growth requirements

Availability

  • Hours of operation – when is it available? Consider weekends, holidays, maintenance times,

etc

  • Locations of operation – where should it be available from, what are the connection

requirements?

Reliability

  • Mean Time Between Failures – What is the acceptable threshold for down-time? e.g. one a

year, 4,000 hours

  • Mean Time To Recovery – if broken, how much time is available to get the system back up

again?

Integrity

  • Fault trapping (I/O) – how to handle electronic interface failures, etc

  • Bad data trapping - data imports, flag-and-continue or stop the import policies, etc

  • Data integrity – referential integrity in database tables and interfaces

  • Image compression and decompression standards

2.5 Module Classification

Client based:

E mail Client ( )

E mail ( ) (maintenance)

User ( )

Server based:

E mail Server ( )

In Box:

Page 17: Mail Server Project Report

Inbox List( )

Recipient List( )

Design view:

Font Change( )

Main Function menu GUI( )

Main Login menu GUI( )

Read Mail Window GUI( )

Send Mail Window GUI( )

View Graphics Attachments( )

View Media Attachments( )

View text Attachments( )

Page 18: Mail Server Project Report

3. System Design

DFD: Data Flow Diagram is the graphical description of the system's data and how the processes

transform the data. Data Flow diagram depicts information flow, the information flow and the transforms

that are applied as data move from the input to output. It is the starting point of the design phase that

functionally decomposes the requirement specifications down to the lowest level of details. Thus a DFD

describes what data flows (logical) rather than how they are processed.

Unlike detailed flowchart, Data Flow Diagrams do no supply detailed description of the modules but

graphically describes a system's data and how the data interacts with the system. To construct a Data

Flow Diagram, we use

> Arrows

> Circles

> Open End Box

> Squares

An arrow identifies the dataflow in motion. It is a pipeline through which information is flown like the

rectangle in the flowchart. A circle stands for process that converts data into information. An open-ended

box represents a data store, data at rest or a temporary repository of data. A square defines a source or

destination of system data.

Rules for constructing a Data Flow Diagram

> Arrows should not cross each other.

> Squares, circles and files must bear names.

> Decomposed data flow squares and circles can have same names.

> Choose meaningful names for data flow

> Draw all data flows around the outside of the diagram.

Page 19: Mail Server Project Report

DFD 0:

DFD 1:

user_name, password

Successful Login

username, password

Java Mail ServerClients(User name, Password)

User and Email File

Read mail GUI

Client/ User

Login GUI

Users detail

Compose Mail

View Attached File

Page 20: Mail Server Project Report

Use case Diagram:

A use case diagram at its simplest is a representation of a user's interaction with the system and

depicting the specifications of a use case. A use case diagram can portray the different types of

users of a system and the various ways that they interact with the system. This type of diagram is

typically used in conjunction with the textual use case and will often be accompanied by other

types of diagrams as well.

include

include

Client

Sequence Diagram

Read Mails

Compose Mail

View Attachment

Manage mails

Login

Page 21: Mail Server Project Report

A sequence diagram is a kind of interaction diagram that shows how processes operate with one

another and in what order. It is a construct of a Message Sequence Chart. A sequence diagram

shows object interactions arranged in time sequence. It depicts the objects and classes involved

in the scenario and the sequence of messages exchanged between the objects needed to carry out

the functionality of the scenario. Sequence diagrams are typically associated with use case

realizations in the Logical View of the system under development. Sequence diagrams are

sometimes called event diagrams, event scenarios

A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects that

live simultaneously, and, as horizontal arrows, the messages exchanged between them, in the

order in which they occur. This allows the specification of simple runtime scenarios in a

graphical manner.

Client1 Server Client2

connect to server(user, password)

Login Accepted

Choose create mail

Type message

Add receiver

deliever mail to receiver

Acknowledge (mail sent)

4.System Development

Page 22: Mail Server Project Report

Development includes all those activities that take place to convert from the old system to the new.

The old system consists of manual operations, which is operated in a very different manner from the

proposed new system. A proper implementation is essential to provide a reliable system to meet the

requirements of the organizations. An improper installation may affect the success of the

computerized system.

Module Classification:

E mail Client : Email Client class is used by clients to connect to the server, we have to provide

the server address which can handle all the clients, here we use 127.0.0.1 as the server address.

When client log in to the system , he has two choices depending on whether he is a new user or

existing user, client has to provide his user name and password to connect to the server, if login

accepted then server displays the status of the client if client is the existing user

Client can also create his account to login for next time and use the services.

Email Client is the class used to handle different clients. The basic functions performed in this

class are:

1. Set up the connection information to connect to the server for e.g. port no. used to make

request, ip address of the server etc.

2. Get different clients or users information from the server

3. Launch the login GUI, Login GUI used by different clients to login to the system.

4. Sends any mail in clients inbox back to server

5. Delete, add mail function can also be performed by the client

Methods in Email Client Class:

1. Getusernamesfrom_server(): this function returns all the user names in the server,

2. Shutdown(): This method is called when client shut down or logout from his account.

When client shutdown or closes his window, all the mails in his inbox will be transferred

to the server again.

Page 23: Mail Server Project Report

3. Backup_mail(): This method is used to create copy of client inbox for undeletion. Create

one vector and transfer all mails from inbox to that vector.

4. Restore_mail(): This method is used to restore the mails from backup list to the inbox list.

This method transfer mails from backup vector to the client inbox.

Client Handler Class:

1. This class implements using thread handling concepts

2. Receive user name from client and set thread name to client name

3. Recieve messages from client

4. Send messages to client from server

5. Recieve correct login name from client or new user name

Methods in Client Handler Class:

1. getUserNameFromClient():recieve correct login name from client or new user name

2. recieveMessagesFromClient()

3. sendMessagesToClient()

Create User GUI Class:

This class handles the operation of registering the new user. This class perform various

operations:

1. Enable clients to create a new user account.

2. Check whether user name chosen by client is already registered or not

3. If user name is already registered then display message, this user name already registered

with us.

4. If chosen user name is not yet registered then accept the new user successfully

Methods of Create user GUI class:

Page 24: Mail Server Project Report

1. checkUserExists (String username, String password): check whether this username and

password is already registered or not.

2. sendUserNameToServer(String userName, String password): if new user is successfully

registered then send the information of new user to the server.

3. sendUserNameToClient(String userName, String password): if new user is successfully

registered then also send the new user name to the clients.

Login Window GUI: This class used to create the form for accepting user input for user

name and password.

Various operations performed by this class are:

1. validate the user name and password entered by the user.

2. if user name and password is correct then display the message “ login accepted”

3. if user name and password is incorrect then display the message “ Entered user name and

password is incorrect”

4. Send logged in users name to server

Methods in login GUI class:

1. sendUserNameToServer(String userName, String Password): if user is successfully

logged in to the system then send the logged in information to the server.

2. checkUserExists(String userName, String password): this method check whether the

given user name and password registered in to the system or not, this method simply

validate the user.

Page 25: Mail Server Project Report

Email Server Class :

Email server class is used to run the server and to accept the connections from different clients,

Email server accepts the connection on port no 1234, Email server class reads the different

clients and display the status of each client.

It also reads mails from the mail data file , when server shut down all the clients connected to it

would also be shutdown. Email server can handle multiple clients at a time

Various functions performed by Email Server class:

1. create vector for storing users and mails.

2. Set up the socket to accept the connection

3. Update server window details when new client is connected.

4. Extract information from files like users and mails detail

Methods in Email server class:

1. startUpServer(): This method start the server, with in this method two other methods are

called to read the users and mails from data files.

2. readInUserNamesFromServerFile():gets a vector of user names from persistent storage,

set up file input stream from persistent server file to get the user name from users.dat file

3. readInMailFromServerFile():gets a vector of emails from persistent storage, set up file

input stream from persistent server file to read mails from mail.dat file

4. shutDownServer(): This method called when we want to shut down the server, with in

this method two other methods are called to write the users and mails to data files.

Page 26: Mail Server Project Report

5. writeOutUsersToServerFile():sends all server usernames to file, set up new file output

stream to write the user name back to user.dat file

6. writeOutMailToServerFile():send all server mail to a file, set up new file output stream to

write mails back to mail.dat file.

Email Class:

This class set all the variables for sending mails for e.g. recipient address,

subject, attachment, message, sender etc.

public Email()

{

sender = "";

recipient = "";

subject = "";

content = "";

attachmentName = "";

attachment = null;

read = false;

}

1. It accepts all the values from client while composing mail, and temporary store the

values by using get and set methods

Methods in Email class:

Page 27: Mail Server Project Report

1. setAttachment(File temp): if client attach some file along with the content then this

method being called, it converts reference to file object into byte array for serialization

Font Change Class:

This class defines various styles of font, clients can use any font style to write the content of

mail.

Method used in Font class:

1. itemStateChanged(ItemEvent e): This method change the state or style of selected text

according to the selected choice.

if (e.getSource() == plain)

selectedFont = plainFont;

else if(e.getSource() == bold)

selectedFont = boldFont;

else if(e.getSource() == italic)

selectedFont = italicFont;

else if(e.getSource() == boldItalic)

selectedFont = boldItalicFont;

Inbox List Class: this client creates inbox for the clients

2. it adds various features to the inbox for e.g. read mail, delete mail, forward mail etc.

3. This class gets the mails from server and display in to the respective client inbox

4. Client can select any mail from number of mails to read, delete, forward etc.

Main Function menu class: This class handles various operations, and called methods of other

classes for operations like send, read according to the client choice

1. Create GUI for sending mails, if client wants to send mail to other client

2. Create GUI for reading mails, if client wants of read mail

Page 28: Mail Server Project Report

3. This class doesn’t perform any own operation but simply called the methods of other

classes

Read mail Window GUI: 1. Create GUI for sending emails

2. This class used to read mails

3. When user select any message for read operation from inbox list and click on read button

then this class is being called.

4. This class displays the detail of sender, message etc for e.g. sender address, attached file

size, content etc

5. It provides various choices to the clients like view attachment, save attachment, forward

mail, change display font

6. Clients can save attached file, view attached file, forward mail etc.

Method in read mail GUI:

This class has only one method i.e. action performed in which four others functions are

implemented according to the user choice

actionPerformed(ActionEvent e):

if(e.getSource() == viewAttachment): if user makes view attachment choice then application that

can open attached file get open.

if(e.getSource() == saveAttachment): if user makes save attachement choice then create new file

ouptut stream and save that file in to the system

if(e.getSource() == forward): if user makes forward choice then send mail window class is being

called for sending mail to another user as shown

SendMailWindowGUI sendMailWinGUI = new SendMailWindowGUI(email);

if(e.getSource() == changeFont): ): if user makes change font choice then fontchange class being

called for implementing font change in the mail

Send mail window GUI: when user choose send option then this class is being called for

sending mails

Page 29: Mail Server Project Report

1. Call email class to define various fields like receiver address, attachments, content

etc.

2. Defines GUI in which user can make different choices like send, send attachment,

multiple receptionist.

3. User can write content by different font style

Methods:

Actionperformed(Event e):

if(e.getSource() == send): this means user want to send simple text message, check for multiple

receptionist and then call sendmail() method.

if(e.getSource() == sendAttachment): this means user wants to attach file.

Steps:

Create new file chooser.

Select type of file chooser

Get result of file chooser

If cancel return to send mail window

Create new file from chooser selection

Add attachment to email

if(e.getSource() == multipleRecipients)

Create new recipient list window

Set multiple recipients to true

2. Sendmail(): this function sends mail to the server,

set the new output stream .

Set up mail information

email.setSender(EMailClient.getCurrentUserName());

Page 30: Mail Server Project Report

email.setRecipient(recipient);

email.setSubject(textSubject.getText());

email.setContent(textMessage.getText());

send mail to server

objectOut.writeObject(email);

objectOut.flush();

View Graphics Attachments( ) : helps us view graphics attachments attached along to

mail. When client clicks on view attachement, according to the file type application is opened to

display the attached file.

For e.g if attached file is image file, default image viewer opened.

Screen Shots:

Starting Server: when server startup then two operations performed

1. read users from user.dat file

Page 31: Mail Server Project Report

2. read mails from mail.dat file

Email Server:

Starting client: when client start, it displays two button

1. login existing user

2. create new user

Page 32: Mail Server Project Report

1. Login existing user: when user select existing user then login window GUI is opened and

user has to enter correct user name and password.

When login successfully accepted, server window automatically updated as shown below

Page 33: Mail Server Project Report

2. Create new user: when user select create new user, user can create account by choosing

different user name from existing users.

Now user is connected to the server and can send message to any other user in the

system, send mail window GUI display all the clients user name when user clicks on

receiver address as shown below.

Page 34: Mail Server Project Report

User can send simple text message, attach file, change display font, and can add multiple

receptionist to the mail

Send Attachement:

Page 35: Mail Server Project Report

Change Display Font:

Italic:

Bold Italic Font:

Users can check their accounts whether they have any message to read , when client log

in to his account, his inbox messages will be displayed in the list, user can select any

mail from the list.

Page 36: Mail Server Project Report

Now user can select any mail from the above list and can forward mail to any other client

, delete selected mail, etc.

Page 37: Mail Server Project Report

Users can restore the deleted mails back to the inbox list, all the deleted mails would be

stored in the backup list and can be restore any time.

Page 38: Mail Server Project Report

All the detail automatically updated in the server window, like client connection, client

disconnection, client read mail etc. as shown below

Page 39: Mail Server Project Report