首页| 新闻| 娱乐| 游戏| 科普| 文学| 编程| 系统| 数据库| 建站| 学院| 产品| 网管| 维修| 办公| 热点
String username=request.getParameter("login");String password=request.getParameter("password");Session session2=Session.getInstance(System.getProperties() ,null);Store store=session2.getStore("pop3");
try{ store.connect(host,username+"%nyist.net", password);}catch(javax.mail.AuthenticationFailedException e){content="用户名与密码不匹配";}
store.connect("nyist.net",-1,request.getParameter("username")+"%nyist.net",request.getParameter("password"));
Folder folder = store.getFolder("INBOX");Folder.open (Folder.READ_WRITE);Message message[]=folder.getMessages();FetchProfile fp=new FetchProfile();fp.add(FetchProfile.Item.ENVELOPE);fp.add(FetchProfile.Item.FLAGS);fp.add("X-Mailer");folder.fetch(message,fp);
String contentbody="";Object o=message[j].getContent();
if (message[j].isMimeType("text/plain")) { contentbody=(String)+"</td>"; StringBuffer buf=new StringBuffer(contentbody.length()+6); char ch=' '; for(int p=0;p<contentbody.length();p++)//若遇到换行就转为<br> {ch=contentbody.charAt(p); if(ch=='/n')buf.append("<br>"); else buf.append(ch); } contentbody=buf.toString();}
else if (message[j].isMimeType("text/html")) contentbody=(String)o+"</td>";
String host = "nyist.net";String from = request.getParameter("from");String to = request.getParameter("to");String subject = request.getParameter("subject");String content = request.getParameter("content");Properties props = System.getProperties();//设置邮件服务props.put("mail.smtp.host", host);Session session2 =Session.getInstance(props, null);
MimeMessage message =new MimeMessage(session2);message.setFrom(new InternetAddress(from));message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));message.setSubject(subject);message.setSentDate(new Date());// create the message partMimeBodyPart messageBodyPart =new MimeBodyPart();
messageBodyPart.setText(content);Multipart multipart = new MimeMultipart();multipart.addBodyPart(messageBodyPart);
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){ com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i); if (!myFile.isMissing()) { myFile.saveAs("/upload/" + myFile.getFileName()); count ++;}
for(int i=0;request.getParameter("file"+i)!=null;i++){ messageBodyPart = new MimeBodyPart(); File file=new File("/home/mengyu/ROOT/upload/",request.getParameter("file"+i)); DataSource source =new FileDataSource(file); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(request.getParameter("file"+i)); multipart.addBodyPart(messageBodyPart);}// Put parts in messagemessage.setContent(multipart);
Transport.send(message);
Folder folder=store.getFolder("INBOX");folder.open(Folder.READ_WRITE);Message message[]=folder.getMessages();String msg[]=request.getParameterValues("msg");for(int i=0,n=msg.length;i<n;i++) message[Double.valueOf(msg[i]).intValue()].setFlag(Flags.Flag.DELETED,true);folder.close(true);
//添加用户Runtime.getRuntime().exec("/home/vpopmail/bin/vadduser"+request.getParameter("username")+"@nyist.net "+request.getParameter("passwd"));//删除用户Runtime.getRuntime().exec("/home/vpopmail/bin/vdeluser"+request.getParameter("username")+"@nyist.net");//修改用户密码Runtime.getRuntime().exec("/home/vpopmail/bin/vpasswd"+request.getParameter("username")+"@nyist.net "+request.getParameter("passwd"));
选择笔记本处理器(CPU)需避免那
如何玩转笔记本视频输出的三种
选择笔记本处理器(CPU)需避免那些误区和基
校园甜美的背影,洋溢着青春烂漫的回忆
芭蕾舞蹈表演,真实美到极致
游览合肥滨湖湿地公园 美不胜收的湿地景
夏日图赏:初夏若雨等花开
肉食主义者的最爱美食烤肉图片
夏日甜心草莓美食图片
人逢知己千杯少,喝酒搞笑图集
搞笑试卷,学生恶搞答题
新闻热点
疑难解答
图片精选
基于EJB技术的商务预订系统的开发
在jsp中用bean和servlet联合实现用
用JSP创建可重用的图形背景
轻松使用JSP生成饼图
网友关注