You are on page 1of 31

SHRI VAISHNAV INSTITUTE OF TECHNOLOGY AND SCIENCE

E MAIL SYSTEM
MINOR PROJECT 2004
INFORMATION TECHNOLOGY VI Semester Guided By Submitted By

Ms. Sunita Verma (3304) Mr. Anand Rajawat (3326)

Neeti Bagani Saba Karimi

CERTIFICATE
This is to certify that this project report entitled E MAIL SYSTEM Has been prepared by Neeti Bagani And Saba Karimi students of III year I.T. The system has been approved by the Department of Information Technology, Shri Vaishnav Institute of Technology and Science, Indore (M.P.) and the work has been done under our guidance. This work is up to the mark of satisfaction. We wish them success in every aspect of life. They have performed this project on their own. They have also put in sufficient time for completion. This project has been completed as per rules of R.G.P.V Syllabus for Minor Project VI semester. Date: Place: Indore

Mr. Anand Rajawat

Ms. Sunita Verma

ACKNOWLEDGMENT
We feel immense pleasure and deep feeling of gratitude towards Ms. Sunita Verma and Mr. Anand Rajawat of Shri Vaishnav Institute of Technology and Science, Indore for their skillful guidance, constructive and valuable suggestion and encouraging co-operation for our project, which not merely helped but enable us to give effort towards this project. We also extend our thanks to all our colleagues and friends for their valuable assistance and kind co-operation during the course of this investigation.

Date: Place: Indore Neeti Bagani Saba Karimi

CONTENTS
S NO
1 2 Abstract Introduction i Definition of Project ii Technical details of Project iii Need of Project 3 Analysis i Hardware Requirements ii Software Requirements iii Other Requirements 4 5 Feasibility Design i Algorithm ii Data Flow Diagram 6 8 9 10 Instructions for using the Project Conclusion Bibliography Annexure 8 10 14 15 16 17 6 6 6 7 2 3 5

TOPIC

PAGE NO
1

ABSTRACT
Email has become one of the driving forces behind connecting businesses to the Internet. It offers fast, economical transfer of messages. The substantial cost cutting by using an email system has encouraged many businesses to invest in an implementation of email systems. The email server is an application to facilitate sending and receiving of emails. Our project works towards implementing the socket programming and providing the user with multithreading to enable servicing of various clients simultaneously. This project is a basic client server model and it can be extended to implement SMTP and POP3 protocols.

INTRODUCTION Definition of the Project


A mail server is an application that receives email from email clients or other mail servers. It is the workhorse of the email system. A mail server usually consists of a storage area, a set of user definable rules, a list of users and a series of communication modules. An email client is an application that is used to read, write and send email. In simple terms it is the user interface to the email system.

Technical Details of the Project


The email system consists of a server and one or more clients. The clients can send and receive mails from / to other clients. The server monitors the entire task. A socket is created in the server for each client and in client for each task wanting server control.

Simple office email system:


Email is required within a company, but not out to the rest of the world. A very simple email system could be installed and maintained, giving interoffice communications:

In the above example, the three workstations are connected to a computer network within a company office. If one user wishes to send email to another user, then the message is simply typed and sent to the mail server, addressed to the recipient using their email name, which would simply be the first name of a user, such as "Neeti". For example: if Saba wants to send a message to Neeti, she types her message on her email client, addressing it to Neeti. Her email client then sends the message to the mail server (via SMTP protocol), where it is stored for Neeti. When Neeti next checks to see if there is any mail for her, her
7

email client will collect her messages (using POP3 protocol) and allow her to read them. Because this email system works only within the office, each recipient can be referred to using only his or her email name. This system could easily be expanded to allow for remote users if some form of dial in support is added to the network using a modem (A modem is a device that sends computer signals down a telephone line, effectively making a telephone system a part of a computer network). This would increase the flexibility of the system enormously.

Need of the Project


Email has become one of the driving forces behind connecting businesses to the Internet. It offers fast, economical transfer of messages. The substantial cost cutting by using an email system has encouraged many businesses to invest in an implementation of email systems. Messages can be sent at any time to a group of people or a single recipient, without the sender leaving their desk. Messages can be logged, ensuring some form of record is held, and the messages are stored when the recipients are away from their desk. Also, the person you are sending the message to gets it directly, without passing through any third party. Imagine there is a Multi National Corporation where there are lakhs of workers working. It is not feasible for everyone to have communication personally. For this purpose E-mail is the apt solution. But to have E-mail ID on the available servers can cause troubles because there is heavy traffic on the available servers. So if we have our own server then it would be pretty easy and fast, as traffic would be limited to the employees of the company only. And there will be no spam mails because only employees would be able to use the system. Also, almost all institutions, companies, homes etc use a LAN and / or Internet. So, we can easily understand how the whole process actually works by practically implementing it.

ANALYSIS Hardware Requirements


64 MB RAM 50 MB Hard Disk Pentium processor with 300 MHz Network Interface Card (NIC) 600*800 monitor

Software Requirements
Windows 9X/XP/NT OS JDK 1.4 Java Editor RDBMS Oracle 8I

10

FEASIBILITY Economic Feasibility


Economic consideration is crucial for any system. These considerations include a broad range of cost-benefit analysis; long-term corporate income & strategies .The cost/benefit analysis is proved out to be positive for our Project.

Technical Feasibility
Resource Availability:
Are the hardware and software resources required available to develop the application?

Technology:
Do the system designers have the skills and guidance to achieve their goal?

Legal Feasibility

11

A development of any infringement, violation or liability that could result from development of the system violates legal feasibility. There is no such law or rule, which will be violated by the development of this software.

DESIGN Algorithm
Connection Establishment:
1 Get a port number from the user or use default. 2 Create a server socket on that port number. 3 Wait indefinitely for an attempt by a client to connect. 4 Bind the client with the server port after accepting it. 5 Get output and input stream objects that enable the server to communicate with the clients. 6 Communicate with the client. 7 Terminate connection when transmission is complete.

Login:
1 Enter the E-mail ID if there is already one assigned or else select the new user option. 2 The new user option allows the user to get a new E-mail ID. 3 The password check for authenticity checks the password from the database.

12

4 In case of forgetting password there is the option for hint question submitted at the time of creating the ID.

Inbox:
1 There is a complete record of all the e-mails received and you can select any one for viewing or can delete any e-mail. 2 The compose option allows the user to write mail or attach files to be sent to other users. 3 There is also the facility for word processing, word completion and stationery for easy and better composing. 4 After completion of work the user can log out from his account, thereby terminating the connection.

13

Data Flow Diagram


Level 0 DFD:

Message from User 1

E-Mail Server

Message to User 2

14

Level 1 DFD:

New User

Entry Form

Connection

Connection Established

Existing User

Logi n

Logout

Compos e

Inbox

Connection Terminated

View Filter Attach Files Write Mails


Mails

Delet e

Stationer y

Word Processing

Send
15 Mails

Level 2 DFD:
Connection Establishment:

Administrator

Create Server Socket

Wait for Client Connection Established Bind Client and Server

User

Create Client Socket

16

Login:

Existing User

Login

Connection Established

New User

Fill up registration form

Registered User

17

INSTRUCTIONS FOR USING THE PROJECT


1. The user should not type a password greater than 8 characters. 2. At the time of login, the login name and password must be same as given at the time of account creation. 3. The login button provided the login name can access the login window and password is correct. 4. While composing the receivers name must be present in the database. 5. After the work is complete the user must logout from the inbox.

18

CODING
The two important modules in our project are: Client
import import import import java.io.*; java.net.Socket; java.net.UnknownHostException; java.util.LinkedList;

public class Client { public Client() { } public static void main(String args[]) { int i = 2222; String s = "localhost"; if(args.length < 2) { System.out.println("Usage: java User \nNow using host=" + s + ", port_number=" + i); } else { s = args[0]; i = Integer.valueOf(args[1]).intValue(); } try { clientsocket = new Socket(s, i); oos = new ObjectOutputStream(clientsocket.getOutputStream()); ois = new ObjectInputStream(clientsocket.getInputStream()); 19

} catch(UnknownHostException _ex) { System.out.println("Don't know about host " + s); } catch(EOFException _ex) { System.out.println("server terminated connection"); } catch(IOException ioexception) { System.err.println("Couldn't get I/O for the connection to the host " + s); ioexception.printStackTrace(); } try { Login login = new Login(); Object obj = null; while(login.objectlogin.loginname == null && login.objectlogin.password == null && login.objectnewuser.loginname == null && login.objectnewuser.password == null && login.objectnewuser.retype == null && login.objectnewuser.index == 0 && login.objectnewuser.answer == null) ; oos.writeObject(login.objectlogin); if(login.objectnewuser.loginname != null || login.objectnewuser.password != null || login.objectnewuser.retype != null || login.objectnewuser.index != 0 || login.objectnewuser.answer != null) { oos.writeObject("1"); oos.writeObject(login.objectnewuser); while(login.objectlogin.loginname == null && login.objectlogin.password == null) ; } else { boolean flag = login.objectlogin.loginname == null && login.objectlogin.password == null; oos.writeObject("2"); System.out.println("Sucessfull"); } Integer integer = (Integer)ois.readObject(); System.out.println("integer object recieved"); int j = integer.intValue(); System.out.println("i=" + j); LinkedList linkedlist = (LinkedList)ois.readObject(); 20

System.out.println("after recieving linklist"); Inbox inbox; for(inbox = new Inbox(linkedlist); inbox.objectcompose.to == null && inbox.objectcompose.from == null && inbox.objectcompose.subject == null && inbox.objectcompose.data == null;); System.out.println("After 2 while"); System.out.println(inbox.objectcompose.to); System.out.println(inbox.objectcompose.from); System.out.println(inbox.objectcompose.subject); System.out.println(inbox.objectcompose.data); oos.writeObject(inbox.objectcompose); System.out.println("client send inbox object"); oos.flush(); oos.close(); } catch(Exception exception) { System.out.println(exception); } } static Socket clientsocket = null; static ObjectOutputStream oos = null; static ObjectInputStream ois = null; }

Server
import java.io.*; import java.net.*; import java .sql.*; import java.util.*; public class Server1 { static Socket clientsocket = null; static ServerSocket serversocket = null;

21

static ObjectOutputStream oos=null; static ObjectInputStream ois=null; public static Connection connection; public static Statement statement; public static ResultSet resultset; public static void main(String args[]) { int port_number=2222; if (args.length < 1) { System.out.println("Usage: java MultiThreadChatServer \n"+ "Now using port number="+port_number); } else { port_number=Integer.valueOf(args[0]).intValue(); } try { serversocket = new ServerSocket(port_number); clientsocket = serversocket.accept(); oos=new ObjectOutputStream(clientsocket.getOutputStream()); ois=new ObjectInputStream(clientsocket.getInputStream()); } catch (IOException e) { System.out.println(e); } 22

catch(Exception e) { System.out.println(e); } //The url is specifing the database to which this program //connects using jdbc to connect to a microsoft odbc database String url="jdbc:odbc:email"; //try to load the driver to allow connection to the server_database try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); connection=DriverManager.getConnection(url); } catch(ClassNotFoundException cnfex) { System.err.println("failed to load jdbc/odbc driver"); cnfex.printStackTrace(); System.exit(1); }//terminate programe catch(SQLException sqlex) { System.err.println("Unable To Connect"); sqlex.printStackTrace(); } try { 23

statement=connection.createStatement(); String query=null; String query1=null; int i=0; String name=null; String str,sender,subject,data; String msg="i have recieved your object"; ObjectNew objectnewuser; ObjectLogin objectlogin; objectlogin=(ObjectLogin)ois.readObject(); str=(String)ois.readObject(); LinkedList list=new LinkedList(); ObjectInbox inbox[]=new ObjectInbox[10]; if(str.equals("1")) { objectnewuser=(ObjectNew)ois.readObject(); query="insert into email_table (loginname,password,index,answer) values('"+objectnewuser.loginname +"','"+objectnewuser.password+"','"+objectnewuser.index+"','"+objec tnewuser.answer+"')"; int result=statement.executeUpdate(query); if(result== 1) System.out.println("Insertion successful"); else System.out.println("Insertion unsuccessful"); str="2"; }

24

System.out.println(objectlogin.loginname); System.out.println(objectlogin.password); query="SELECT * FROM email_table "+"WHERE loginname='"+objectlogin.loginname+"'"; name=objectlogin.loginname; System.out.println("after query"); resultset=statement.executeQuery(query); boolean more=resultset.next(); System.out.println("boolean="+more); while(more){ System.out.println("in while"); i=i+1; more=resultset.next(); } System.out.println("after recordnumber"); if(i==0) System.out.println("no record found"); else System.out.println("recordnumber="+i); Integer integer=new Integer(i); oos.writeObject(integer); System.out.println("integer Object send"); System.out.println("name" +name); query1="SELECT * FROM email_compose "+"WHERE reciever='"+name+"'"; resultset=statement.executeQuery(query1); more=resultset.next(); System.out.println("boolean="+more); 25

while(more){ System.out.println("in 2 while"); sender=resultset.getString(2); subject=resultset.getString(4); data=resultset.getString(5); System.out.println("sender="+sender); System.out.println("subject="+subject); System.out.println("data="+data); inbox[i]=new ObjectInbox(sender,subject,data); list.add(inbox[i]); more=resultset.next(); } oos.writeObject(list); System.out.println("after sending linklist"); ObjectCompose objectcompose=new ObjectCompose("we"); ObjectLogin object3=new ObjectLogin("we"); objectcompose=(ObjectCompose)ois.readObject(); System.out.println("Server accept inbox objectcompose"); query="insert into email_compose (sender,reciever,subject,data) values('"+objectcompose.from +"','"+objectcompose.to+"','"+objectcompose.subject+"','"+objectco mpose.data+"')"; int result=statement.executeUpdate(query); System.out.println(result); System.out.println("statement executed"); if(result==1) 26

System.out.println("Insertion successfull"); else System.out.println("Insertion unsuccessfull"); /*if(str.equals("2")) { object3=(ObjectLogin)ois.readObject(); System.out.println(object3.loginname); System.out.println(object3.password); query="SELECT * FROM email_table "+"WHERE loginname='"+object3.loginname+"'"; System.out.println("after query"); resultset=statement.executeQuery(query); System.out.println("after resultset"); System.out.println(objectcompose.to); System.out.println(objectcompose.from); System.out.println(objectcompose.subject); System.out.println(objectcompose.data);*/ ois.close(); connection.close(); statement.close(); //} }catch(SQLException sql) { System.out.println("connection does'nt create statement"); sql.printStackTrace(); System.out.println(sql.toString()); } catch(Exception e){ System.out.println(e+"nsit"); } } 27

CONCLUSION
The limitations of our project are: 1. It works only on a LAN. 2. The front end is not very user friendly. 3. The mails are not getting deleted from the inbox. 4. Attachment and Forwarding facilities are not provided. 5. The mail can be only limited to a fixed, predefined length. There were various difficulties encountered in our project which are as follows: 1. It was not clear when to use which class and when to make our own classes as we used core JAVA. 2. The compatibility between the various JAVA editors (JBuilder and Gel) was not proper. There are various suggestions that we would like to give for the future enhancement of this project: 1. Making the front end more user friendly. 2. Implementing it for the use on the Internet and not only LAN.

28

BIBLIOGRAPHY
1. Core JAVA volumes 1 and 2 - Sun Microsystems 2. JAVA How to Program - Deitel and Deitel 3. JAVA the complete reference - Herbert Schildt

29

ANNEXURE A Networking Laboratory for the Developing World Abstract


In todays dynamic and complex commercial developing world, Internet based communication is evolving as an indispensable element for facilitating every aspect. Therefore, it is important that the students be exposed to contemporary networking equipment in a realistic setting, in order to connect theoretical material taught in lecture courses with the realities of physical hardware. We need to provide a realistic environment for teaching in internetworking concepts, gave way to emergence of a large computernetworking laboratory. This laboratory provides university level students with a podium to experiment with fundamental issues of Internet working in a way that cannot be provided by simulators and to a degree of rigor not possible with the commonly available laboratory setup designed for technicians. The article throws an in depth light on the inducing factors that motivated setting up the laboratory, its network structure and its equipment, and the type of experiments the students conduct. The structure of the laboratory consists of 3 modes identical in all the cities. Each simulated city has three layers viz. Layer A, B and C. The hardware and software requirement of the laboratory are: Routers, Switch, Radio Modem, Dial up Modem and PABXs, Patch Panels, Hosts and Linux Operating System respectively. The biggest

30

constraint faced by laboratory structure in the developing world was availability of limited funds. Many of the problems while setting the laboratory were though not experienced in developed nations, thereby making it more valuable to those in the developing world who are contemplating setting up experimental facilities for teaching networking.

31

You might also like