Mail Client in Java

Posted by @wikimatze on

During the summer term 2007 we had the task to create a Thunderbird1 like mail client in Java2.

The GUI should be created either with Swing3 or AWT4. Beside the graphical implementation, we had to check and study the functionality of POP35 and SMTP6. Only the correct numbers in this protocols are important because they stands for each transactions if it was a success or a failure. A first attempt this functionality was done with plain old sockets to get a feeling how POP3 and SMTP works.

After we a running function the basic functions of the mail client, we had to implement some extra-functions like attachments (mime parts in an email) or the handling of emails with drag-and-drop. I implemented this big project with the help of NetBeans7.

Images

By means of the following images I will describe the basic layout of my mailclient.

mail_client_1.jpg

The basic surface when the program starts. If you press on the upper task bar a drag-and-drop menu will open.

mail_client_2.jpg

In this window you can add data of a new account.

mail_client_3.jpg

Get the mail of an already existing account.

mail_client_4.jpg

The window where to write a new email.

mail_client_5.jpg

Drag-and-Drop window to manage emails.

Installation for Netbeans

Conclusion

This project was my first big piece of software and I used all my gathered knowledge about Java. The classes are not bug-free, manually tested, has a size over 1000 locs, has absolute paths, and the function are sometimes very big. In the end it was just hacking down the software without using certain patterns or careful development with clean code. I tested my code with System.out.println and I lost so much time with this stupid testing. One good thing I did: I created comments and was able to get the program running even after two year.

Nowadays programming methodologies like Agile8, Rapid-Prototyping or Model-Driven development together with the framework Rails let you develop my application with much more less effort and is more maintainable by driving the Test-Driven way, so you can refactor your code and don’t need to manual test part of your basis.

This project shows that it is possible to develop modular software in Java but in even greater projects it is easy to get lost in the lost in Java code if you don’t rely on a framework. It is even difficult to setup the project in different IDE - today you can use Vagrant9 to create an environment which can be deployed easily as Virtual images on different platforms.

Further reading

Discussion

About the author: My name is Matthias Günther. This blog collects my thoughts about different topics as are my interests. I maintain an "ask me everything" project on GitHub. Please ask me a question!