• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Mail Problem

 
Barun Saha
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a stand alone program with a main in it. I am ready a table & would like to send emails out to everyone from the table. The method below, gives me the following error. This happens even if the methord is not called.The prgram complies fine, but this is the runtime error I end up getting.
Please help!!.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/SendFailed

private void sendmessage() throws AddressException, MessagingException{
try{
//Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
javax.mail.Session mailSession = Session.getDefaultInstance(props, null);
// Define msg
MimeMessage message = new MimeMessage(mailSession);
message.setFrom(new InternetAddress(from));
//create the recipient

try{
addressTo = new InternetAddress(Responsible);
} catch (AddressException ae){
System.out.println("Soemthing went wrong creating the recipient: " + ae.toString());
}//end try-catch creating new InternetAddress
message.setRecipient(Message.RecipientType.TO, addressTo);
message.setSubject(Subject);

// Fill the message
message.setText(Subject);

// Send message
Transport.send(message);
} catch (SendFailedException sfe){
System.out.println("Something went wrong sending the message: " + sfe.toString());
}//end try-catch sending message
} //end sendNotification()
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to "Other APIs"
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zimby:
What is your CLASSPATH, and do you have the activation.jar and mail.jar files in it? JavaMail is not part of the standard API, and so you will need to download and install those files. You can download these files from SUN's JavaMail pages.
 
Barun Saha
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cindy Glass:
Moved to "Other APIs"

Can you/someone please clarify
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can you/someone please clarify

The "Other Java APIs" forum is the appropriate forum for questions about JavaMail, so it was moved here. I don't know where you asked it originally, but it was deemed off-topic for that forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!