javamail

newmail.jsp //写邮件ui

<%@ page contentType="text/html; charset=gb2312" language="java"
import="org.apache.commons.lang.StringUtils,
mail.domain.*,
mail.service.*,
java.util.*,java.io.*" %>
<%@ include file="init.jsp"%>
<html>
 <head>
  <title>&nbsp;</title>
  <style type="text/css">
      td.color_css02{
      font-size:9pt;
      TEXT-ALIGN:right;
      }
  
      td.color_css03{
      font-size:9pt;
      }
  
      td.color_green{
      font-size:9pt;
      color:green;
      }
  
      input.button_css{
      font-size:9pt;
      }
      body{
      font-size:9pt;
      }
      input {font-size:9pt;}
      img.image_css,input.btt{
      cursor:hand;
      }
      td.btt{
      font-size:9pt;
      TEXT-ALIGN:right;
      }
      td.bttleft{
      font-size:9pt;
      TEXT-ALIGN:left;
      }
      td.radio{
      font-size:9pt;
      }
    </style>
 </head>
 <%
  String loginId = ((Integer)session.getAttribute("idno")).toString();

  String addresser=""; //发件人地址
 
  String titles="test";  //邮件主题
  String comments="Dear ,\n\n"; //邮件内容

  request.setCharacterEncoding("GBK");
 %>

 <BODY bgcolor='#ffffff' οncοntextmenu='return true;' topMargin='1' leftMargin="1" onUnload="opener.location.reload();">
  <form NAME="FormName" METHOD='POST' action="dosendmail.jsp">
   <input type="hidden" name="emplid" value="<%=loginId%>" />
   <input type="hidden" name="addresser" value="<%=addresser%>" />
   <table bgcolor="#ddddd0" width='100%' height='100%' border='0' cellspacing='1' cellpadding='0' align='center' class="color_css03">
    <tr height="100%">
     <td>
      <table border='0' cellspacing='1' cellpadding='1' width="100%"
       class="tab_table_css">
       <tr>
        <td class="color_css02">
         发件人:
        </td>
        <td class="bttleft"><%=addresser%></td>
       </tr>

       <tr>
        <td class="color_css02">
         收件人:
        </td>
        <td>
         <INPUT TYPE="text" class="readonly_css_no_width"
          NAME="addressee" value="<%=mailaddr%>" size="96">
        </td>
       </tr>
       
       <tr>
        <td class="color_css02">
         抄送:
        </td>
        <td>
         <INPUT TYPE="text" class="readonly_css_no_width"
          NAME="addresseeByCC" value="<%=addresser%>" size="96">
        </td>
       </tr>
       <tr>
        <td class="btt">
         主题:
        </td>
        <td>
         <INPUT TYPE="text" class="edit_css_no_width" NAME="mailSubject" value="<%=titles%>" size="96">
        </td>
       </tr>
       <tr hieght="90%">
        <td colspan="2" align="center" height="100%">
         <textarea style="width:100%;height:200px;overflow:auto;" name="mailContent">
<%=comments%>         
         </textarea>
        </td>
       </tr>
       <tr>
        <td class="color_css03" align="right" colspan="2" height="35">
         <INPUT TYPE="submit" class='button_css' value="&nbsp;发&nbsp;送&nbsp;" >
         <INPUT TYPE="button" class='button_css' value="&nbsp;返回&nbsp;" οnclick="window.close();">
        </td>
       </tr>
      </table>
     </td>
    </tr>
   </table>
  </FORM>
 </body>
</html>

 dosendmail.jsp

<%@ page contentType="text/html; charset=GBK" language="java" 
import="mail.service.MailService,mail.domain.MailBean,mail.util.Util"%>
<%
 MailBean mail = new MailBean();
 mail.setMailSubject(request.getParameter("mailSubject"));
 mail.setMailContent(request.getParameter("mailContent"));
 //String mailFile = new String(request.getParameter("mailFile").getBytes("ISO-8859-1"), "GBK");
 //mail.setFile(ECUtil.analysisStringForArrayList(mailFile, ";"));
 
 mail.setAddresser(request.getParameter("addresser"));
 mail.setAddressee(Util.analysisStringForArrayList(request.getParameter("addressee"), ";"));
 mail.setAddresseeByCC(Util.analysisStringForArrayList(request.getParameter("addresseeByCC"), ";"));
 mail.setEmplid(request.getParameter("emplid"));
 boolean succflag=MailService.getInstance().send(mail).booleanValue();
%>
<script language="javascript" type="">
window.resizeTo(1,1);
window.moveTo(screen.availWidth/2-10,screen.availHeight/2-25);
<%if(succflag){%>
alert("发送成功!请到Outlook检查邮件!");
<%}else{%>
alert("发送失败!请联系管理员。");
<%}%>
window.close();
</script>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值