Java Mail API and its application-implementation of a Mail list server (1) (Post)

Source: Internet
Author: User
Java Mail API is one of the latest standard extensions developed by Sun. It provides Java application developers with Mail/communication solutions independent of platforms and protocols. This article introduces the core mechanism of this API and demonstrates its usage through a mail forwarding server (mail list server.
The development of Java Mail API is a good example of Sun's continuous efforts to provide a public API framework for Java developers. A public framework is promoted to oppose solutions restricted by suppliers, which fully predicts the establishment of an increasingly open development environment.
In the email communication field, developers (and users) for the final application can purchase the public API framework that best suits their needs, low-level developers can provide effective solutions to access specific mail services. The significance is that a small development group can focus on developing high-performance client mail software, and it is quite easy to provide support in different mail environments; large development organizations focus on providing public access support for newly developed enterprise mail services, and obtaining rich application software support. The biggest winner is information system users who can easily integrate products and solutions provided by different vendors as required (performance, investment, etc.
One of the keys to developing a highly reusable open API framework is to emphasize the abstract interface technology, that is, supporting future extension and optional implementation based on the existing standards. Java Mail API embodies this idea. Sun and other developers are providing default implementations and tools for most existing public standards and protocols. Available support includes at least POP3, SMTP, and IMAP.
1. Java Mail API Introduction
The structure of the Java Mail API proves that the workload of software development depends on the complexity of the application and the degree of control required by the developer. In other words, the Java Mail API is as simple as possible. The example program ListServer (and the demo program included in the API package) attached to this article fully demonstrates this.
At first glance, the total number of classes in the Java Mail API and the relationship between classes may be misunderstood as a long learning period. In fact, once you start using the API, you will find that this API is a simple tool to add robust email/communication support to the application.
The number of classes included in the Java Mail API is much greater than the number of classes involved here. The following describes the functions and functions of some core classes in sequence in a typical application:
◆ Javax. mail. Session
Javax. mail. Session is the entrance class at the highest level of Java Mail API. The most common method is to control and load SPI (Service Provider Implementation) for different mail protocols ). For example, javax. mail. Store is obtained through the Session class.
◆ Javax. mail. Store
The javax. mail. Store class implements read, write, monitoring, and search operations on specific mail protocols. You can use the javax. mail. Store class to access the javax. mail. Folder class.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.