当前位置: 技术问答>java相关
安原书抄写还是报错,可能是书上的问题!
来源: 互联网 发布时间:2015-11-20
本文导语: 书上代码为: try{ Message email = new MimeMessage(emailsession); email.setFrom(new InternetAddress(senderAddress)); InternetAddress[] address = { new InternetAddress(formRecipient) }; //////// email.setRecipients(Message.RecipientType.To,address); em...
书上代码为:
try{
Message email = new MimeMessage(emailsession);
email.setFrom(new InternetAddress(senderAddress));
InternetAddress[] address = {
new InternetAddress(formRecipient) };
//////// email.setRecipients(Message.RecipientType.To,address);
email.setSubject(req.getServletPath());
email.setSentDate(new Date());
email.setHeader("X-Mailer","MailFormJava");
email.setText(message.toString());
Transport.send(email);
}catch(MessagingException e){
throw new JspException (e.getMessage());
}
报错为:
D:beauser_projectsmydomainmyserver.wlnotdeleteDefaultWebApp_DefaultWebApp_1306213jsp_servlet__mailform.java:139: cannot resolve symbol
symbol : variable To
location: class javax.mail.Message.RecipientType
出错的地方是加了“////////////”的地方
try{
Message email = new MimeMessage(emailsession);
email.setFrom(new InternetAddress(senderAddress));
InternetAddress[] address = {
new InternetAddress(formRecipient) };
//////// email.setRecipients(Message.RecipientType.To,address);
email.setSubject(req.getServletPath());
email.setSentDate(new Date());
email.setHeader("X-Mailer","MailFormJava");
email.setText(message.toString());
Transport.send(email);
}catch(MessagingException e){
throw new JspException (e.getMessage());
}
报错为:
D:beauser_projectsmydomainmyserver.wlnotdeleteDefaultWebApp_DefaultWebApp_1306213jsp_servlet__mailform.java:139: cannot resolve symbol
symbol : variable To
location: class javax.mail.Message.RecipientType
出错的地方是加了“////////////”的地方
|
javax.mail.Message.RecipientType没有引入这个类。
|
我觉得没什么错,可能是你自己大意吧
|
(Message.RecipientType.To,address);
Message.RecipientType.To这表示什么?
Message.RecipientType.To这表示什么?
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。