我是新手使用库,但我需要能够向忘记密码的用户发送电子邮件.我正在尝试使用JavaMail和Apache Commons Email来实现这一点.但是,我认为我必须错误地导入库.
当我尝试发送电子邮件时,收到以下消息:
Apr 17, 2011 11:54:33 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 60 in the jsp file: /sendpw.jsp
The type javax.mail.Authenticator cannot be resolved. It is indirectly referenced from required .class files
Run Code Online (Sandbox Code Playgroud)
代码:
57: EmailAuthentication ea = new EmailAuthentication();
58: String authUser = ea.getUser();
59: String authPw = ea.getPw();
60: email.setAuthenticator(new DefaultAuthenticator(authUser, authPw));
61: email.setTLS(true);
62: email.setFrom(authUser+"@gmail.com");
63: email.setSubject("Your Last Love Password"); …Run Code Online (Sandbox Code Playgroud)