exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
servlet.SendEmail.doPost(SendEmail.java:38)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.ClassNotFoundException: javax.mail.internet.AddressException
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
servlet.SendEmail.doPost(SendEmail.java:38)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)问题补充:
public boolean send() {
try {
//创建SMTP邮件协议发送对象
Transport transport = session.getTransport("smtp");
//取得与邮件服务器的连接
transport.connect((String) props.get("mail.smtp.host"), name,password);
//通过邮件服务器发送邮件
transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
transport.close();
return true;
} catch (NoSuchProviderException e) {
e.printStackTrace();
return false;
} catch (MessagingException e) {
e.printStackTrace();
return false;
}
}
}
|
|