Q&A

Q1:Why does an e-mail system require retrieval protocols?
A1: When a mail server receives a message, it places it within the recipient's mail box. The recipient then connects to the mail server and downloads the message to his or her local machine. The sequence of exchanges between the recipient's machine and the mail server use a retrieval protocol, such as POP3 or IMAP.
Q2:Why do I need to use the Message class's inner class RecipientType when adding a recipient to a message?
A2: There are three types of recipient, TO, CC, and BCC, so you must stipulate the type of recipient you want to add to a message. The RecipientType class exposes three static fields that represent the three types of recipients.
Q3:I want to send a HTML message that includes an embedded image. Why do I need to create a multi-part MIME message?
A3: MIME supports different data formats. It allows you to mix these formats, to create an inline message, by defining messages that consist of multiple body parts. In the case of a HTML message with inline image, one body part contains the HTML and the other part contains the image. The e-mail client will then assemble these parts to create a compound message.
Q4:Which method would I use to print the content of messages retrieved from a mail server?
A4: The Part interface's writeTo() method allows you to output a bytestream for a message part. However, any class that uses the method must provide an appropriate encoding algorithm because the method does not decode a part's content.
Q5:I've written an application that checks whether messages are flagged as RECENT. If they are, the application retrieves them from the server. Why does the application not retrieve any messages from my POP3 server?
A5: The JavaMail API provides a selection of predefined message flags, but there is no guarantee that a mail server will support all these flags. Typically, in the case of a POP3 server, only the DELETED flag is supported, so in this instance, the application will not find any messages marked as RECENT, and thus will not return any messages.
Q6:Why does the MIME Content-Disposition message header mark some messages as inline and others as attached?
A6: The Content-Disposition header has two possible values—inline and attached. An application should use these values to determine how to display a body part's content. Specifically, parts marked inline should display within the message, and those marked attached should be saved to file because they are attachments.
Q7:I'm writing a servlet that retrieves a user's message from an IMAP server. Each user has a unique mail box on the server, how do I ensure that users only access their personal mail boxes?
A7: The Authenticator class allows access to protected resources. You can subclass it, and this subclass can prompt the user for a username and password.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.19.243