Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials

jGuru: Fundamentals of the JavaMail API

 


[Exercise | API Docs | Short Course| Exercises]

Help is available for each task.



    Task 1

    The skeleton code already includes the code to get the list of messages from the folder and prompt you to create a reply.

    Task 2

    When answered affirmitively, create a new MimeMessage from the original message.

    MimeMessage reply = (MimeMessage)message[i].reply(false);
    

    Task 3

    Set the from field to your email address.

    Task 4

    Create the text for the reply. Include a canned message to start. When the original message is plain text, add each line of the original message, prefix each line with the "" characters.

    To check for plain text messages, check the messages MIME type with mimeMessage.isMimeType("text/plain").

    Task 5

    Set the message's content, once the message content is fully determined.

    Task 6

    Send the message.

    Task 7

    Compile and run the program, passing your mail server, SMTP server, username, password, and from address on the command line. Answer YES to the messages you want to send replies. Just hit ENTER if you don't. If you want to stop going through your mail before making your way through all the messages, enter QUIT.

    java ReplyExample POP.Server SMTP.Server username password from@address

    Task 8

    Check to make sure you received the message with your normal mail reader (Eudora, Outlook Express, pine, ...).

Copyright 1996-2001 jGuru.com. All Rights Reserved.