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

    Download the latest version of the JavaMail API implementation from Sun.

    Task 2

    Download the latest version of the JavaBeans Activation Framework from Sun.

    Task 3

    Unzip the downloaded packages. You get a ZIP file for all platforms for both packages.

    You can use the jar tool to unzip the packages.

    Task 4

    Add the mail.jar file from the JavaMail download and the activation.jar file from the JavaBeans Activation Framework download to your CLASSPATH.

    Copy the files to your extension library directory. For Microsoft Windows, and using the default installation copy, the command might look like the following:

    cd \javamail-1.2
    copy mail.jar \jdk1.3\jre\lib\ext
    cd \jaf-1.0.1
    copy activation.jar \jdk1.3\jre\lib\ext
    

    If you don't like copying the files to the exention library directory, detailed instructions are available from Sun for setting your CLASSPATH on Windows NT.

    Task 5

    Go into the demo directory that comes with the JavaMail API implementation and compile the msgsend program to send a test message.

    javac msgsend.java
    

    Task 6

    Execute the program passing in a from address with the -o option, your SMTP server with the -M option, and the to address (with no option). You'll then enter the subject, the text of your message, and the end-of-file character (CTRL-Z) to signal the end of the message input.

    Be sure to replace the from address, SMTP server, and to address.

    java msgsend -o from@address -M SMTP.Server to@address
    

    If you are not sure of your SMTP server, contact your system adminstrator or check with your Internet Service Provider.

    Task 7

    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.