im new to the the mail stuff and smtp stuff .. im trying to make a module to send email ... here is my code and the error it returns is:
Exception in thread "main" java.lang.NoCla ssDefFoundError : javax/activation/DataSource
at src.lacrown.Mai l.main(Mail.jav a:35)
this line:MimeMessag e message = new MimeMessage(s);
what could be wrong? or what am i missing?
thanks in advance
import java.util.*;
import javax.mail.*;
import javax.mail.inte rnet.*;
public class Mail {
static String msgText1 = "This is a message body.\nHere's line two.";
static String msgText2 = "This is the text in the message attachment.";
public static void main(String[] args) throws MessagingExcept ion {
Properties props = new Properties();
props.put("laco ronahotels.com" , "lacoronahotels .com");
Session s = Session.getInst ance(props,null );
InternetAddress from = new InternetAddress ("akoymakoy@yah oo.com");
InternetAddress to = new InternetAddress ("akoymakoyg@ya hoo.com");
MimeMessage message = new MimeMessage(s);
message.setFrom (from);
message.addReci pient(Message.R ecipientType.TO , to);
message.setSubj ect("Your subject");
message.setText ("Your text");
Transport.send( message);
}
}
Exception in thread "main" java.lang.NoCla ssDefFoundError : javax/activation/DataSource
at src.lacrown.Mai l.main(Mail.jav a:35)
this line:MimeMessag e message = new MimeMessage(s);
what could be wrong? or what am i missing?
thanks in advance
import java.util.*;
import javax.mail.*;
import javax.mail.inte rnet.*;
public class Mail {
static String msgText1 = "This is a message body.\nHere's line two.";
static String msgText2 = "This is the text in the message attachment.";
public static void main(String[] args) throws MessagingExcept ion {
Properties props = new Properties();
props.put("laco ronahotels.com" , "lacoronahotels .com");
Session s = Session.getInst ance(props,null );
InternetAddress from = new InternetAddress ("akoymakoy@yah oo.com");
InternetAddress to = new InternetAddress ("akoymakoyg@ya hoo.com");
MimeMessage message = new MimeMessage(s);
message.setFrom (from);
message.addReci pient(Message.R ecipientType.TO , to);
message.setSubj ect("Your subject");
message.setText ("Your text");
Transport.send( message);
}
}
Comment