while sending mail through applet
Hi All,
I have a problem while using the following code in my applet
Here is the code i got the exception.
public void postMail( String smtpHost, String recipients[], String subject,
String message , String file, String from) throws MessagingException
{
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
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 = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setSentDate(new Date());
if(!file.equals(""))
{
BodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
messageBodyPart.setText(message);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName((new File(file)).getName());
multipart.addBodyPart(messageBodyPart);
msg.setContent(multipart);
}
else msg.setContent(message, "text/plain");
Transport.send(msg);
}
->exception
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: javax/mail/MessagingException
And -->
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: javax/mail/Authenticator
--
i set the jar file mail.jar and activation.jar file in tomcat webserver
webapp/ myproj/lib
Can any one please help me?
Thanks,
Kiran

