Home arrow Java arrow Page 3 - Java Mail API: Transforming Mail into Data Carriers

Java Mail API: Transforming Mail into Data Carriers

Java Mail is eminently adaptable. Indeed, looking at its API, we find that it helps us provide an alternative solution to an old problem: how to transfer large amounts of data between two enterprise applications. In this article, you will discover how to adapt Java Mail to play the role of a data carrier.

Author Info:
By: A.P.Rajshekhar
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
November 22, 2005
  1. · Java Mail API: Transforming Mail into Data Carriers
  2. · Java Mail Core Classes Continued
  3. · Mails As Data Carriers: A Practical Approach
  4. · Sending
  5. · Receiving

print this article

Java Mail API: Transforming Mail into Data Carriers - Mails As Data Carriers: A Practical Approach
(Page 3 of 5 )

When data transfer is the issue (in the context of J2EE), there are three possible approaches:

  1. Use Message Driven Beans or JMS.
  2. Use XML over HTTP.
  3. Generate a document in a predefined format (XML/SGML) and send it through mailing.

Usually the first two approaches have been followed until now. The third approach was in a way scoffed at because third party mailing APIs had to be used. But with the advent of the Java Mail API, the third approach is becoming more viable due to the following reasons:

  • The MDB or JMS needs a full fledged application server, which means a higher requirement for system resources.

  • The communication, in the case of MDB, takes place in binary format (unless it is specifically programmed to use base 64). That brings firewalls into the picture.

  • The XML over HTTP approach requires a separate server (e.g.: SOAP server) to perform the required processing, which again means a high end system is required.

Now that the problems with the first two approaches have been clarified, let's see how Java Mail helps in overcoming them. The approach with Java Mail is simple. First, generate the XML document from the data. Second, transfer the data using Java Mail to the required host. Finally, extract the data from the XML attachment and extract the data from the XML document.

In this way, no matter the size of the data, it can be transferred. Here the Mail API doesn’t put any restriction on the size of the attachment. The restriction, if any, comes from the limitations enforced by the Mail server, and that is configurable.

blog comments powered by Disqus

- 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 

Developer Shed Affiliates


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