Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Java Mail Interview Questions and Answers

Ques 1. What is JavaMail?

Ans. Java Mail is an API that is used to receive and send emails between applications. To send the emails, the protocols, SMPT, POP AND IMAP are used. The messages sending and receiving is done by creating a framework using set of abstract classes in the API. The framework allows the application to create customized cross-platform mail application by having basic knowledge of e-mail. There are methods and classes that are used to access mail folders, message downloading and sending messages along with attachments feature.

Potential advantages include - Java mail is used to create personal mail filter, simple mailing lists and personal mail applications. Java mail also includes the capabilities to add the emailing process to an enterprise application or even to create a full-fledged e-mail client. Many companies in the industry have written new e-mail clients using Java Mail.

Is it helpful? Add Comment View Comments
Ques 2. Explain POP, SMTP and IMAP protocols.
Ans. POP: The Post Office Protocol is an application-level protocol within an intranet which are used by the local e-mail clients to send and retrieve e-mails from a remote server those are connected using TCP/IP. POP is one of the most prevalent protocol fro the usage of e-mail. The POP and its procedures support the end-users with dial-up network connections.

POP allows the users to retrieve e-mail when connected and later allows viewing and altering the retrieved messages. This is done with a promising feature – without staying connected. The process of using emails over POP is to connect, retrieve the messages, and store them on the user’s PC as a new message. Later these messages can be ‘deleted from the server’ and disconnecting the server – makes POP a distinguished protocol.

SMTP: Simple Mail Transfer Protocol, for sending email between ‘servers’. Most of the emailing systems implement the messages over internet use SMTP. The message sent from one server to another server, and then the message can be retrieved by an email client. The client uses either POP or IMAP. In addition to this process, SMTP is also generally used for message sending and retrieval from a mail client to a mail server. This is the reason why the need of POP or IMAP server and the SMTP servers at the time of configuring the email application.

IMAP: Short for Internet Message Access Protocol. This is another most prevalent protocol of internet standard for email usage apart from POP. Usually all the modern email server and client supports these two protocols for transmitting the email messages. For Example Gmail server uses to transmit the message to a client such as Mozilla Thunderbird and Microsoft Outlook.

IMAP is an application layer protocol over internet that is operating from port no. 143 that allows the accessibility of email on a remote server by a client. IMAP supports the online and offline (disconnected) modes of operations. Usually the email clients using IMAP utilizes the facility of leaving the message on the server. The message lasts until the user explicitly deletes them. IMAP also allows multiple clients to have the accessibility of the same mailbox.
Is it helpful? Add Comment View Comments
Ques 3. Explain the use of MIME within message makeup.
Ans. MIME message includes the picture stored as file in GIF format and the GIF format uses 8-bit format. The RFC 822 uses ASCII text format. The messages in the form of ASCII text format is to be encoded. To display the image in the recipient system, the information abut the encoding mechanism is used. The message is to be made up in the recipient’s application. The following snippet is used to identify the content is a GIF file which is to be encoded using the standard “base64Algorithm. This is to be treated as an attachment by the client who uses the email.

Content-Type: image/gif;
name="waterfall.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="waterfall.gif"
[Author the encoded content here]
..

The accomplishment of this is done by simplifying and rebuilding of complex files. These files are encoded and transported as a body of the message or a series of messages which are the parts of the file.

A message format is defined by the MIME that allows the following:

Non ASCII character textual message bodies.
Non textual message bodies
Message bodies that are multipart
Non ASCII character textual header information

Code Example:
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(args[0])};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Hello");
msg.setSentDate(new Date());
msg.setText("Mail Message");
Is it helpful? Add Comment View Comments
Ques 4. Explain the structure of Javamail API
Ans. The JavaMail API has classes such as Message, Store and Transport. The API can be used to subclass for providing new protocols and some additional functionality when needed. The concrete subclasses of this API are MimeMessage and MimeBodyPart which are implemented widely by the internet mail protocols. The supporting protocols for Javamail API are IMAP4, POP3 and SMTP.

The Java mail architectural components include the following:

Abstract Layer: This layer declares the classes, interfaces and abstract methods that are intended for supporting the mail functions which all mailing systems supports.

Intranet Implementation Layer: The implementation of MIME internet standards and part of the abstract layer comprises this layer.

Java Bean Activation Framework: The encapsulation of message data and handling the data interacting commands is used by the Javabean Activation Framework.
Is it helpful? Add Comment View Comments
Ques 5. Discuss about JavaMail.
Ans. 1) JavaMail is a set of abstract classes that create a framework for sending, receiving and handling e-mail.
2) The package that Sun provides contains implementations of IMAP and SMTP, which allow sending and receiving mail.
3) The framework eases the creation of cross-platform mail application without an in-depth knowledge of e-mail.
4) There are methods and classes that allow access to mail folders, download messages, send messages with attachments and filter mail.
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook