• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error:javax/mail/Message(java.lang.NoClassFoundError)  RSS feed

 
Ravi Mandalapu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am developing E-mail application using javamailAPI.
The code is compiling fine, but it is throwing runtime exception as:
Error: Javax/mail/Message(java.lang.NoclassFoundError)
<no stack trace avilable>
My code:
Properties properties = new Properties();
properties.put("mail.transport.protocol", "smtp");
properties.put("mail.smtp.host","mail");
properties.put("mail.from",Field2.getText());
Session session = Session.getInstance(properties,null);
try {
Message message = new MimeMessage(session);
InternetAddress[] address = {new InternetAddress(Field1.getText())};
message.setRecipients(Message.RecipientType.TO,address);
message.setFrom(new InternetAddress(Field2.getText()));
message.setSubject(Field3.getText());
message.setContent(Text1.getText(),"text/html");
Transport transport = session.getTransport(address[0]);
transport.addConnectionListener(new ConnectionHandler());
transport.addTransportListener(new TransportHandler());
transport.connect();
transport.sendMessage(message,address);
} catch(Exception e) { Text2.setText(e.toString()); }
}
if anyone had this experience, please let know.
If any help from anyone,i will be greatly appreciate.
Thankx in Advanch.
Ravi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!