getmail.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:4k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" %>
  2. <%@ page import="fan.mail.GetMail"%>
  3. <%@ page import="fan.mail.MailMsg"%>
  4. <%@ page import="fan.mail.Attachment"%>
  5. <%@ page import="java.util.*"%>
  6. <html>
  7. <head>
  8. <title>取邮件</title>
  9. <link href="../common.css" rel="stylesheet" type="text/css">
  10. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
  11. <%@ include file="../inc/nocache.jsp" %>
  12. <body leftmargin="0" topmargin="5">
  13. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  14. <jsp:useBean id="userservice" scope="page" class="com.redmoon.oa.person.UserService"/>
  15. <jsp:useBean id="fnumber" scope="page" class="fan.util.FNumber"/>
  16. <jsp:useBean id="cfgparser" scope="page" class="fan.util.CFGParser"/>
  17. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  18. <%
  19. String priv="read";
  20. if (!privilege.isUserPrivValid(request,priv))
  21. {
  22. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  23. return;
  24. }
  25. %>
  26. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  27.   <tr>
  28.     <td height="23" valign="bottom" background="../images/tab-b6-top.gif">     <span class="right-title">收 件 箱</span></td>
  29.   </tr>
  30.   <tr>
  31.     <td height="281" valign="top" background="../images/tab-b-back.gif"> <br>
  32. <%
  33. cfgparser.parse("config.xml");
  34. Properties props = cfgparser.getProps();
  35. String mailserver = props.getProperty("mailserver");
  36. String pop3_port = props.getProperty("pop3_port");
  37. String[] r = userservice.getUserEmailNamePwd(privilege.getUser(request));
  38. if (r==null) {
  39. out.println(fchar.p_center("你的请邮箱尚未开通,请向管理员申请!"));
  40. return;
  41. }
  42. int port = Integer.parseInt(pop3_port);
  43. String email_name = r[0];
  44. String email_pwd_raw = r[1];
  45. GetMail getmail = new GetMail(mailserver,port,email_name,email_pwd_raw);
  46. Vector maillist = getmail.receive("list");
  47. String mailID = "";
  48. if (maillist.size()==0)
  49. {
  50. out.println(fchar.p_center("无邮件!"));
  51. }
  52. else {
  53. %>
  54. <form id=form1 name=form1 action="opmail.jsp" method="post">
  55.       <table width="96%" border="0" align="center" cellpadding="2" cellspacing="0" class="stable">
  56.         <tr align="middle" bgcolor="#C4DAFF" class="stable">
  57.           <td width="6%" class="stable">&nbsp;</td>
  58.           <td width="8%" align="center" nowrap class="stable">优 先</td>
  59.           <td width="8%" align="center" nowrap class="stable">状 态</td>
  60.           <td width="21%" align="center" nowrap class="stable">发件人</td>
  61.           <td width="22%" align="center" nowrap class="stable">主 题</td>
  62.           <td width="19%" align="center" nowrap class="stable">日 期</td>
  63.           <td width="16%" align="center" nowrap class="stable">大 小</td>
  64.         </tr>
  65.         <%
  66. java.util.Enumeration msglist = maillist.elements();
  67. while (msglist.hasMoreElements())
  68. {
  69.   MailMsg msg = (MailMsg)msglist.nextElement();
  70.   mailID = msg.getID();
  71. %>
  72.         <tr class="stable" align="center">
  73.           <td class="stable"><input title="选择/不选" type="checkbox" value="<%=msg.getID()%>" name="mailids"></td>
  74.           <td class="stable">&nbsp; </td>
  75.             <td class="stable">&nbsp; </td>
  76.           <td class="stable"><a href="sendmail.jsp?to=<%=msg.getFrom()%>"><%=msg.getFrom()%></a></td>
  77.           <td class="stable"><a href="showmail.jsp?mailid=<%=msg.getID()%>"><%=msg.getSubject()%></a></td>
  78.           <td class="stable"><%=fchar.formatDate(msg.getSentDate())%></td>
  79.           <td class="stable"><%=fnumber.round((double)msg.getSize()/1000,2)%> k
  80.               <%
  81. if (msg.hasAttachment()) {%>
  82.               <img src="images/attach.gif">
  83.           <%}
  84. %>          </td>
  85.         </tr>
  86.         <%   
  87. }
  88. %>
  89.       </table>
  90.       <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  91.         <tr>
  92.             <td align="center"><br><input type="hidden" name="op">
  93.               <a href="javascript:form1.op.value='del';form1.submit()">删除所选邮件</a></td>
  94.         </tr>
  95.       </table></form> 
  96. <%}%>   
  97.   </td>
  98.   </tr>
  99.   <tr>
  100.     <td height="9"><img src="../images/tab-b-bot.gif" width="494" height="9"></td>
  101.   </tr>
  102. </table>
  103. </body>
  104. </html>