Hello
I am able to send email from Outlook Express using SMTP server installed on my pc.
Like this I want to send email from a
java code using JavaMail.
The code is as follows
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import java.lang.*;
public class JDMailer
{
public static void main(
String [] args) throws Exception
{
Properties props = new Properties();
props.put("mail.smtp.host","localhost");
Session session = Session.getDefaultInstance(props,null);
session.setDebug(true);
MimeMessage msg = new MimeMessage(session);
InternetAddress addressfrom = new InternetAddress ("anil_n@sancharnet.in");
msg.setFrom(addressfrom);
Address addressTo = new InternetAddress("basappa_jodalli@rediffmail.com");
msg.setRecipient(Message.RecipientType.TO,addressTo);
msg.setSubject("dddd");
msg.setContent("uuuuuooooooooyyyyyyyyyyyrrrrrrrrr","text/plain");
Transport transport = session.getTransport("smtp");
transport.send(msg);
}
}
I am getting this error
Exception in
thread �main� java.lang.NoClassDefFoundError :com/sun/mail/util/SharedByte ArrayInputStream
at JDMailer.main(JDMailer.java:15)
I have set the classpath to include j2ee.jar from my Sun\AppServer\lib directory of
J2EE.
Pls help me out immediately