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> </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=" 发 送 " >
<INPUT TYPE="button" class='button_css' value=" 返回 " ο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>