我正在按照本教程从应用引擎发送电子邮件。
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
String msgBody = "...";
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("myAppAdmin@gmail.com"));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress("AnotherMailOfMine@gmail.com"));
msg.setSubject("Your Example.com account has been activated");
msg.setText(msgBody);
Transport.send(msg);
} catch (AddressException e) {
// ...
} catch (MessagingException e) {
// ...
}
但是我收到此错误
javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.Boolean net.adeptus.client.util.UtilService.sendMailActivation(net.adeptus.client.DTO.PlayerDTO)' threw an unexpected exception: java.lang.NoClassDefFoundError: com/sun/mail/util/TraceOutputStream
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at
我已经检查过我没有使用 Oracle jar 并且邮件发件人存在。
任何想法?