• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Java Mail Problem

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to "Other APIs"
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cindy Glass:
Moved to "Other APIs"


Can you/someone please clarify
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic