![]() ![]() ![]() |
|
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
![]() |
||||||||||||||||||
|
||||||||||||||||||
Help is available for each task.
Task 1The skeleton code already includes the code to get the initial mail session, create the main message, and fill its headers (to, from, subject). Task 2Create a Task 3Create a text string of the HTML content. Include a reference in the HTML to an image (<img src="...">) that is local to the mail message. Use a String htmlText = "<H1>Hello</H1>" + "<img src=\"cid:memememe\">"; Task 4Set the content of the message part. Be sure to specify the MIME type is messageBodyPart.setContent(htmlText, "text/html"); Task 5Create a MimeMultipart multipart = new MimeMultipart("related"); multipart.addBodyPart(messageBodyPart); Task 6Create a second Task 7Get the attachment as a Task 8Set the messageBodyPart.setHeader("Content-ID","memememe"); Task 9Add the second part of the message to the multipart, and set the content of the message to the multipart. Task 10Send the message. Task 11Compile and run the program, passing your SMTP server, from address, to address, and filename on the command line. This will send the images as an inline image within the HTML text. java HtmlImageExample SMTP.Server from@address to@address filename Task 12Check if your mail reader recognizes the message as HTML and displays the image within the message, instead of as a link to an external attachment file. If your mail reader can't display HTML messages, consider sending the message to a friend. Copyright 1996-2001 jGuru.com. All Rights Reserved. |