top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

JavaMail API

0 votes
613 views

                                                      JavaMail

The JavaMail is an API that is used to compose, write and read electronic messages (emails).

The JavaMail API provides protocol-independent and plate form-independent framework for sending and receiving mails.

There are two aspects to which needs to understand, they are Check and Fetch.

  • Checking an email in JavaMail is a process where we open the respective folder in the mailbox and get each message. Here we only check the header of each message i.e the From, To, subject. Content is not read.

  • Fetching an email in JavaMail is a process where we open the respective folder in the mailbox and get each message. Along with the header we also read the content by recognizing the content-type.

 

There are some protocols that are used in JavaMail API

  • SMTP

  • POP

  • IMAP

  • MIME

  • NNTP and others

JavaMail Architecture

                                        

The java application uses JavaMail API to compose, send and receive emails. The JavaMail API uses SPI (Service Provider Interfaces) that provides the intermediatory services to the java application to deal with the different protocols.

JavaMail API Core Classes

There are two packages that are used in Java Mail API: javax.mail and javax.mail.internet package. These packages contains many 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 etc

Go through this video:-

posted Sep 16, 2017 by Pooja Singh

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button


Related Articles

What is REST API?

REST stands for Representational state transfer.

It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used.

REST is often used in mobile applications, social networking Web sites, mashup tools and automated business processes. The REST style emphasizes that interactions between clients and services is enhanced by having a limited number of operations (verbs). Flexibility is provided by assigning resources (nouns) their own unique universal resource indicators (URIs).

REST involves reading a designated Web page that contains an XML file. The XML file describes and includes the desired content.

The REST architectural style describes six constraints. The six constraints are:

  1. Uniform Interface
  2. Stateless
  3. Cacheable
  4. Client-Server
  5. Layered System
  6. Code on Demand

RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.

REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.).

REST is not a "standard". There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often "roll your own" with standard library features in languages like Perl, Java, or C#.

As a programming approach, REST is a lightweight alternative to Web Services and RPC.

Much like Web Services, a REST service is:

  • Platform-independent
  • Language-independent
  • Standards-based (runs on top of HTTP), and
  • Can easily be used in the presence of firewalls.

Like Web Services, REST offers no built-in security features, encryption, session management, QoS guarantees, etc. But also as with Web Services, these can be added by building on top of HTTP:

  1. For security, username/password tokens are often used.
  2. For encryption, REST can be used on top of HTTPS (secure sockets).... etc.

Video Tutorial About What is REST?

https://www.youtube.com/watch?v=llpr5924N7E

READ MORE
...