Protocols used in JavaMail API

There are a unit some protocols that area unit employed in JavaMail API.

  1. SMTP
  2. POP
  3. IMAP
  4. MIME
  5. NNTP and other
  6. SMTP

SMTP

SMTP is Associate in Nursing signifier for straightforward Mail Transfer Protocol. It provides a mechanism to deliver the e-mail. we are able to use Apache James server, Postcast server, cmail server etc. as Associate in Nursing SMTP server. however if we tend to purchase the host house,Associate in Nursing SMTP server is bydefault provided by the host supplier. as an example, my smtp server is mail.javatportal.com. If we tend to use the SMTP server provided by the host supplier, authentication is needed for causing and receiving emails.

POP

POP is Associate in Nursing signifier for Post workplace Protocol, additionally called POP3. It provides a mechanism to receive the e-mail. It provides support for single mail box for every user. we are able to use Apache James server, cmail server etc. as Associate in Nursing POP server.however if we tend to purchase the host house, Associate in Nursing POP server is by default provided by the host supplier. as an example, the pop server provided by the host supplier for my web site is mail.javatportal.com. This protocol is outlined in RFC 1939.

IMAP

IMAP is Associate in Nursing signifier for web Message Access Protocol. IMAP is a complicated protocol for receiving messages. It provides support for multiple mail box for every user ,in addition to, mailbox will be shared by multiple users. it's outlined in RFC 2060.

MIME

Multiple web Mail Extension (MIME) tells the browser what's being sent e.g. attachment, format of the messages etc. it's not called mail transfer protocol however it's employed by your mail program.

NNTP and Other

There area unit several protocols that area unit provided by third-party suppliers. a number of themarea unit Network News Transfer Protocol (NNTP), Secure utile web Mail Extensions (S/MIME) etc.


JavaMail Architecture

The java application uses JavaMail API to compose, send and receive emails. The JavaMail API uses SPI (Service supplier Interfaces) that gives the intermediatory services to the java application tomanage the various protocols. Let's know it with the figure given below:

JavaMail API Core Classes

There are two bundles that are utilized as a part of Java Mail API: javax.mail and javax.mail.internet bundle. These bundles contains numerous classes for Java Mail API. They are:

  • javax.mail.Session class
  • javax.mail.Message class
  • javax.mail.internet.MimeMessage class
  • javax.mail.Address class
  • javax.mail.internet.InternetAddress class
  • javax.mail.Authenticator class
  • javax.mail.PasswordAuthentication class
  • javax.mail.Transport class
  • javax.mail.Store class
  • javax.mail.Folder class and so forth.

We will think about these class one by one when it is getting utilized.