⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewmailall.jsp

📁 JSP常用模块源代码之邮件管理模块的全部源代码
💻 JSP
字号:
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*,java.io.*,java.text.*" %>
<%@ page import="javax.mail.*,javax.mail.internet.*,javax.activation.*,service.Mail" %>
<style type="text/css">
<!--
p {  font-family: "宋体"; font-size: 9pt;}
td {font-size: 9pt ; line-height:normal; }
A{text-transform: none; text-decoration: none;font-size: 9pt;}
a:hover {text-decoration:underline; color: #0000a0; font-size: 9pt}
body {  font-size: 9pt}
.mjMenuLink {
 	text-decoration: none; 
	CURSOR: hand;
}
-->
</style>
<%
Session mailsession=Session.getInstance(System.getProperties(),null);
mailsession.setDebug(false);
Store store=mailsession.getStore("pop3");//protocol为连接协议,IMAP或是POP
//store.connect("192.168.1.9","zb@hncccb.com","right");//mailhost主机,user为用户名,passwd为密码
store.connect(session.getAttribute("pop").toString(),session.getAttribute("user").toString(),session.getAttribute("pwd").toString());//mailhost主机,user为用户名,passwd为密码
Folder folder = store.getFolder("INBOX");
try 
{ folder.open(Folder.READ_WRITE);} 
catch (MessagingException ex) 
{ 
  folder.open(Folder.READ_ONLY);}
  Message message[]=folder.getMessages(); 
  Mail pmm = null;
  out.println("您的邮箱的收件箱中共有"+message.length+"封邮件:<br>"); 
%>
  <table width="98%" border="0" align="center" cellspacing="0" bgcolor="#EFF7FF" style='border-top:1px #8CA5B5 solid;'>
    <tr bgcolor="#DBEAF5" style='border:1px #8CA5B5 solid;font-size: 9pt;'>
      
    <td nowrap style="border-left:1px #8CA5B5 solid; border-bottom:1px #8CA5B5 solid;"> 
      <div align="center"><font class="s" color="#104A7B"><b>序号</b></font></div>
      </td>
      
    <td nowrap style="border-left:1px #8CA5B5 solid; border-bottom:1px #8CA5B5 solid;"> 
      <div align="center"><font class="s" color="#104A7B"><b>状态</b></font></div>
      </td>      
      
    <td nowrap style="border-left:1px #8CA5B5 solid; border-bottom:1px #8CA5B5 solid;"> 
      <div align="center"><font class="s" color="#104A7B"><b>发件人</b></font></div>
      </td>
      
    <td nowrap style="border-left:1px #8CA5B5 solid; border-bottom:1px #8CA5B5 solid;"> 
      <div align="center"><font class="s" color="#104A7B"><b>主题</b></font></div>
      </td>
      
    <td nowrap style="border-left:1px #8CA5B5 solid; border-bottom:1px #8CA5B5 solid; border-right:1px #8CA5B5 solid;"> 
      <div align="center"><font class="s" color="#104A7B"><b>日期</b></font></div>
      </td>
    </tr>
<%
  for(int i=0;i<message.length;i++){
            pmm = new Mail((MimeMessage)message[i]);
            pmm.setDateFormat("yy年MM月dd日 HH:mm");%>
  <tr>
    <td align="center" height="26" style='border-bottom:1px #8CA5B5 solid;'><%=i+1%></td>
    <td align="center" height="26" style='border-bottom:1px #8CA5B5 solid;'><%
    	if (pmm.isNew())
    			out.print("新邮件");
    	else if(pmm.getReplySign())
    			out.print("已回复");
    	%>&nbsp;</td>
    <td height="26" style='border-bottom:1px #8CA5B5 solid;'><%=pmm.getFrom()%></td>
    <td height="26" style='border-bottom:1px #8CA5B5 solid;'><a href='viewmail.jsp?id=<%=i%>'><%=pmm.getSubject()%></a></td>
    <td height="26" style='border-bottom:1px #8CA5B5 solid;'><%=pmm.getSentDate()%></td>
  </tr>
  <%}%>
</table>
<%
  folder.close(true);
  store.close();
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -