Hi,
I am using websphere and trying to use javax.mail api . However i am receiving the errors as I am not able to

import javax.activation.*;

import javax.mail.*;

the statements, the reason is Websphere does not recognize them, I am not sure whether i have the javax package. Could any one help me out on how to get the javax package and configure it in Websphere.
Thank you.

JavaMail is available here:
http://java.sun.com/products/javamail/index.jsp

However, from the following search results:
http://www.google.com/search?hl=en&q=+site:publib.boulder.ibm.com+javamail+websphere
It seems that WebSphere includes JavaMail. Many of the links above are references to older versions, so I am not sure if they have changed any of that, but they are probably worth checking out. It may be a simple alteration to your application classpath to find the jars.

JavaMail is included in the J2EE API which Websphere application server implements. So yes, it knows it.

It's just a question of setting up your classpath correctly for your editor/IDE to also know what you're talking about.
The manual (which you'll have if you indeed bought Websphere Studio which you're probably talking about) will tell you all about that.
If you didn't buy it why should we help you use pirated software?

Thank you very much, now i got the compatible version of jar files, now i am receiving another error as follows.......

java.lang.NoClassDefFoundError:Messaging Exception

I am using the following code :

import javax.mail.*;
        import javax.mail.internet.*;
        import java.util.*;
public class TestEmail {

    public static void main(String[] args){
    TestEmail e = new TestEmail();
    System.out.println("hi");
    String str[] = {"sufiparvez@gmail.com"};
    System.out.println("hello");
    try{

        e.postMail(str,"check","hi","parvez_patel@xyz.com");
        System.out.println("In try block");
    }
    catch(MessagingException e1){
                    System.out.println(e1);
    }

    }
        public void postMail ( String recipients[ ], String subject, String message , String from) throws MessagingException
        {
            boolean debug = false;

             //Set the host smtp address
             Properties props = new Properties();
             props.put("mail.smtp.host","smtp.abc.xyz.com");

            // create some properties and get the default Session
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);

            // create a message
            Message msg = new MimeMessage(session);

            // set the from and to address
            InternetAddress addressFrom = new InternetAddress(from);
            msg.setFrom(addressFrom);

            InternetAddress[] addressTo = new InternetAddress[recipients.length]; 
            for (int i = 0; i < recipients.length; i++)
            {
                addressTo[i] = new InternetAddress(recipients[i]);
            }
            msg.setRecipients(Message.RecipientType.TO, addressTo);


            // Optional : You can also set your custom headers in the Email if you Want
            msg.addHeader("MyHeaderName", "myHeaderValue");

            // Setting the Subject and Content Type
            msg.setSubject(subject);
            msg.setContent(message, "text/plain");
            Transport.send(msg);
        }
    }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Thank you, the issue seems to be with the Jre version 1.3 , which has been selected by default. I have changed it to Jre Version 1.4. Now it seems to be working fine. My issue has been resolved. Thanks for the prompt reply.

This question has already been answered. Start a new discussion instead.