Explain the use of MIME within message makeup.
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 are 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
Explain the use of MIME within message makeup.
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");
This section creates the actual message object and fills in the to, from, subject, date and content. There are also options to set the reply to, content and content type, and other header information. Since this is a MIME - Multipurpose Internet Mail Extensions - message, it need not be plain text.
A DataHandler can be set using setDataHandler() in MimeMessage to handle nontext parts. This is a simple one-part text message, the setText() can be used.