JavaMail API Introduction
JavaMail API is an optional package (standard extension) that can be used to read, write, and send electronic messages ). You can use this package to create a Mail User Agent (MUA) program similar to Eudora, Pine, and Microsoft Outlook. The main purpose is not to transmit, send, and forward messages as in a Mail transmission Agent (MTA) program. In other words, you can interact with MUA programs to read and write emails. MUA relies on MTA to process actual sending tasks.
The JavaMail API is designed to provide protocol-independent access for sending and receiving information. This API is divided into two parts:
· The first part of this API is the focus of this course. Basically, it is how to send and receive messages independent of the provider/protocol.
· The second part uses specific protocol languages, such as SMTP, POP, IMAP, and NNTP. If you want the JavaMail API to communicate with the server, you need to provide the protocol for it. Since Sun has a full introduction to specific protocol providers and users can obtain them for free, this course does not cover creating specific protocol providers.
Review related protocols
Before learning the deep knowledge of the JavaMail API, let's look back at the protocols used in this API. Essentially there are four common protocols:
· SMTP
· POP
· IMAP
· MIME
You also need to know about NNTP and other protocols. Understanding the basic principles of these protocols helps you understand how to use the JavaMail API. The design of this API has nothing to do with the protocol, so the restrictions of these basic protocols cannot be overcome. If the selected protocol does not support a certain function, the JavaMail API cannot add this function to it. (As you will see later, this problem is often encountered when operating the POP protocol ).
SMTP
Simple Mail Transfer Protocol (SMTP) is a mechanism used to send emails. In the JavaMail API environment, your JavaMail-based program will communicate with the SMTP server of your company or Internet service provider (ISP. The SMTP server forwards the message to the SMTP server used to receive the message. The user can obtain the message through POP or IMAP protocol. Because authentication is supported, the SMTP server is not required to be an open forwarder, but you must ensure that the SMTP server is correctly configured. The JavaMail API does not integrate functions for processing tasks such as configuring servers to forward messages or adding/deleting email accounts.
POP
POP refers to the Post Office Protocol. The current version is 3, also known as POP3, which is defined in RFC 1939. POP is a mechanism that most people on the Internet use to receive emails. It defines support for each user's mailbox. This is all the work it has done and is also the root cause of most problems. POP does not support many features that people are familiar with when using the POP protocol, such as how many new mail messages are received. These functions are built into email programs such as Eudora or Microsoft Outlook, so that you can remember the last email you received and calculate the number of new emails. Therefore, if you want to obtain this type of information when using the JavaMail API, you need to calculate it yourself.
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