Home arrow Java arrow Java Mail API: Getting Started
JAVA

Java Mail API: Getting Started


In this article, the first in a multi-part series, you will learn the basics of Java Mail and how to use it for data exchange. This article covers the concepts surrounding different mailing protocols, the APIs that form the basis of Java Mail, and the creation of a class containing common email-related functionalities.

Author Info:
By: A.P.Rajshekhar
Rating: 4 stars4 stars4 stars4 stars4 stars / 43
November 16, 2005
TABLE OF CONTENTS:
  1. · Java Mail API: Getting Started
  2. · Mail Protocols: Rules that Govern Email
  3. · Java Mail: Understanding the API
  4. · Java Mail: Putting it all together

print this article
SEARCH DEVARTICLES

Java Mail API: Getting Started
(Page 1 of 4 )

Communication is the backbone of any enterprise. Communication, without exchange of data, is unimaginable. In the context of communication between Enterprise level applications, the amount of data would be huge. So using traditional approaches in Electronic Data Interchange wouldn’t suffice.

If one ponders over the other options viable in this context, especially in the area specific to J2EE, there are a few. These include the Java Messaging Service (or JMS for short) that can transfer data up to 4 M.B in size. But what doesn’t get mentioned is the existing set of APIs that were primarily designed for the purpose of exchanging amount of data up to 15 MB. These APIs constitute Java Mail APIs.

The design goal was to develop a set of interfaces that would help in setting up an emailing environment. But the interfaces were such that the data could be sent not only to mail servers, but also to any server capable of understanding mail protocols. That brought almost every J2EE server into the picture. Thus APIs created for mail exchange provided a means to exchange huge amounts of data.

In this two part article I will be discussing the basics of Java Mail and using them for data exchange. In this article, which is the first part, I will focus on the basics.  The concepts surrounding different mailing protocols will be discussed in the next section. The section after that will cover the APIs that form the basis of Java Mail.

In the final section I will put it all together to create a class containing common functionalities such as connecting to a server, getting the messages and logging out. The server I will be using is Apache James, as it comes preconfigured for mailing purposes. Though any server could be used, the reason for using James, especially for experimenting purposes, is that when other J2EE servers are used, they have to be configured. In the case of Apache James, the configuration is as simple as unpacking and setting up the environment variables. It also provides a good number of examples to help you understand the working of the mail API. So now, let’s get started with the Java Mail API.


blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials