coolgem
asked on
How to resolve Unhandled exception type javax.mail.MessagingException?
How do I resolvethe MessagingException error for the program below and at next to the last line"postEmailObject.postM ail(recipi ents, subject, message, from);" is where I get a squigley line depicting an error. In the Consle the the error reads java.lang.Error: Unresolved compilation problem:
Unhandled exception type javax.mail.MessagingExcept ion
at java.lang.reflect.Construc tor.newIns tance(Nati ve Method)
at xxx.xxx.xxx.xxx.TestMail.m ain(TestMa il.java:24 )(line 24 is different here because I excluded the package statement.
Exception in thread "main"
:
/**
* @author tjw
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Te mplates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Co de Generation.
*/
public class TestMail {
static String setRay[] = {"name@blah.com"};
public static void main(String[] args) throws MessagingException {
System.out.println("Begin TestSchedular");
DocChangeChecker dockChg = new DocChangeChecker();
String[] recipients = setRay;
String subject = "Testing Batch Email frm a bat file";
String message = "Never fear Theodore is here";
String from = "name@blah.com";
System.out.println("Past DocChangeChecker");
//create the object first
//then pass the arguments for the paramaters
PostEmail postEmailObject = new PostEmail();
postEmailObject.postMail(r ecipients, subject, message, from); //error here
System.out.println("Past PostEmail");
}
}
Unhandled exception type javax.mail.MessagingExcept
at java.lang.reflect.Construc
at xxx.xxx.xxx.xxx.TestMail.m
Exception in thread "main"
:
/**
* @author tjw
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Te
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Co
*/
public class TestMail {
static String setRay[] = {"name@blah.com"};
public static void main(String[] args) throws MessagingException {
System.out.println("Begin TestSchedular");
DocChangeChecker dockChg = new DocChangeChecker();
String[] recipients = setRay;
String subject = "Testing Batch Email frm a bat file";
String message = "Never fear Theodore is here";
String from = "name@blah.com";
System.out.println("Past DocChangeChecker");
//create the object first
//then pass the arguments for the paramaters
PostEmail postEmailObject = new PostEmail();
postEmailObject.postMail(r
System.out.println("Past PostEmail");
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.