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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" language="java"%>
  2. <%@ page import="fan.mail.GetMail"%>
  3. <%@ page import="fan.mail.MailMsg"%>
  4. <%@ page import="fan.mail.Attachment"%>
  5. <%@ page import="java.util.*"%>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  7. <html>
  8. <head>
  9. <link href="../common.css" rel="stylesheet" type="text/css">
  10. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  11. <title>显示邮件</title>
  12. <style type="text/css">
  13. <!--
  14. body {
  15. margin-left: 0px;
  16. margin-top: 3px;
  17. }
  18. -->
  19. </style></head>
  20. <body>
  21. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  22. <jsp:useBean id="cfgparser" scope="page" class="fan.util.CFGParser"/>
  23. <jsp:useBean id="userservice" scope="page" class="com.redmoon.oa.person.UserService"/>
  24. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  25.   <tr>
  26.     <td height="23" valign="bottom" background="../images/tab-b6-top.gif">     <span class="right-title">查 看 邮 件</span></td>
  27.   </tr>
  28.   <tr>
  29.     <td valign="top" background="../images/tab-b-back.gif">
  30.       <p>
  31. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  32. <%
  33. String priv="read";
  34. if (!privilege.isUserPrivValid(request,priv))
  35. {
  36. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  37. return;
  38. }
  39. %>   
  40. <%
  41. cfgparser.parse("config.xml");
  42. Properties props = cfgparser.getProps();
  43. String mailserver = props.getProperty("mailserver");
  44. String[] r = userservice.getUserEmailNamePwd(privilege.getUser(request));
  45. if (r==null) {
  46. out.println(fchar.p_center("你的请邮箱尚未开通,请向管理员申请!"));
  47. return;
  48. }
  49. String email_name = r[0];
  50. String email_pwd_raw = r[1];
  51. String mailid = fchar.getNullStr(request.getParameter("mailid"));
  52. if (!fchar.isNumeric(mailid)) {
  53. out.println(fchar.Alert_Back("邮件编号无效!"));
  54. return;
  55. }
  56. GetMail getmail = new GetMail(mailserver,email_name,email_pwd_raw);//pub.zj.jsinfo.net","fgf163","1011");
  57. MailMsg mailmsg = getmail.getMessageOfNum(Integer.parseInt(mailid));
  58. if (mailmsg==null) {
  59. out.println(fchar.p_center("邮件为空!"));
  60. return;
  61. }
  62. String[] Recipients = mailmsg.getRecipients();
  63. %>
  64. </p><br>
  65.       <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="stable">
  66.         <tr class="stable">
  67.           <td width="13%" bgcolor="#C4DAFF" class="stable">发件人: </td>
  68.           <td width="35%" bgcolor="#C4DAFF" class="stable"><a href="sendmail.jsp?to=<%=mailmsg.getFrom()%>"><%=mailmsg.getFrom()%></a></td>
  69.           <td width="15%" bgcolor="#EEEEEE" class="stable"> 发送日期:</td>
  70.           <td width="37%" bgcolor="#EEEEEE" class="stable"><%=fchar.formatDate(mailmsg.getSentDate())%></td>
  71.         </tr>
  72.         <tr class="stable">
  73.           <td bgcolor="#EEEEEE" class="stable">收件人:          </td>
  74.           <td bgcolor="#EEEEEE" class="stable"><%
  75. if (Recipients!=null) {
  76. int rl = Recipients.length;
  77. for (int i=0; i<rl; i++){
  78. out.print(Recipients[i]+"&nbsp;");
  79. }
  80. }
  81. %></td>
  82.           <td bgcolor="#EEEEEE" class="stable">优先级:</td>
  83.           <td bgcolor="#EEEEEE" class="stable">普通</td>
  84.         </tr>
  85.         <tr class="stable">
  86.           <td bgcolor="#EEEEEE" class="stable">附 &nbsp;件:          </td>
  87.           <td bgcolor="#EEEEEE" class="stable"><%
  88.   Vector attachs = mailmsg.getAttachments();
  89.   int size = attachs.size();
  90.   if (attachs!=null && size>0) {
  91.   Enumeration e = attachs.elements();
  92.   while (e.hasMoreElements()) {
  93. Attachment a = (Attachment)e.nextElement();
  94. out.print("<img src=images/attach.gif>");
  95. out.print("<a href='getattach.jsp?mailid="+mailmsg.getID()+"&attachnum="+a.getNum()+"'>"+a.getName()+"</a><BR>");
  96.   }
  97.   }
  98.   else
  99.    out.print("无");
  100. %></td>
  101.           <td bgcolor="#EEEEEE" class="stable">抄 送:</td>
  102.           <td bgcolor="#EEEEEE" class="stable">(无)</td>
  103.         </tr>
  104.         <tr bgcolor="#FFFFFF" class="stable">
  105.           <td colspan="4" class="stable">主 题:<%=mailmsg.getSubject()%></td>
  106.         </tr>
  107.         <tr bgcolor="#FFFFFF" class="stable">
  108.           <td colspan="4" class="stable">            <%=mailmsg.getContent()%> </td>
  109.         </tr>
  110.       </table>
  111.       <p><br> 
  112.  </p></td>
  113.   </tr>
  114.   <tr>
  115.     <td height="9"><img src="../images/tab-b-bot.gif" width="494" height="9"></td>
  116.   </tr>
  117. </table>
  118. </body>
  119. </html>