write.jsp
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:12k
- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
- <%@ page import="com.softeem.webmail.dao.mail.*" %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <title>发送邮件</title>
- <style type="text/css">
- <!--
- .Max {
- width: 100%;
- }
- -->
- </style>
- <script language="JavaScript" src="include/CheckDataFunction.js" type="text/JavaScript"></script>
- <script language="javascript">
- <!--
- <% Mail replymail=(Mail)request.getSession(false).getAttribute("replymail");
- Mail forwardmail=(Mail)request.getSession(false).getAttribute("forwardmail");
- %>
-
- function doSendAndSave()
- {
- if(setSend())
- {
- EditForm.action="writeMail.do?method=sendsave";
- setFiles();
- EditForm.submit();
- }
- else
- return false;
- }//sendsave
- function doSend()
- {
- if(setSend())
- {
- EditForm.action="writeMail.do?method=send";
- setFiles();
- EditForm.submit();
- }
- else
- return false;
- }//sendsave
- function doSave()
- {
- if(setSend())
- {
- EditForm.action="writeMail.do?method=save";
- EditForm.submit();
- }
- else
- return false;
- }//sendsave
-
- function choiceAddress(Obj)
- {
- var str='';
- urls="address.ejf?easyJWebCommand=choice";
- str=window.showModalDialog(urls,"addAccessory","dialogWidth:500px;dialogHeight:400px;help:no;status:no");
- choice(Obj,str)
-
- }
- function choice(Obj,str)
- {
- var allValue=Obj.value;
- if(str!=null)
- {
- if(allValue!=null && allValue!="")
- {
- allValue = allValue+",";
- }
- var tmpValue='';
- var Value=str.split('<>');
- for(var x=0;x<Value.length;x++)
- {
- if(Value[x]!='')
- {
- tmpValue=Value[x].split('|')
- if(allValue.indexOf(tmpValue[0])==-1)
- allValue+= tmpValue[0]+",";
- }
- }
- }
- Obj.value = allValue.substring(0,allValue.length-1);
- }
- function DelCID(Obj)
- {
- for(var x=Obj.length-1;x>=0;x--)
- {
- if(Obj.options[x].selected)
- {
- Obj.options[x]=null;
- }
- }
- }
-
- function changeEdit(obj)
- {
- if(EditForm.editMode.value == 'html')
- {
- if(!window.confirm('警告:如果将该邮件格式改为纯文本,可能会造成格式信息丢失!'))
- return false;
- EditForm.editMode.value = '1';
- EditForm.text.value = htmlRichedit.getPureText();
- EditForm.richedit.value= htmlRichedit.getPureText();
- htmlView.style.display="none";
- textView.style.display="";
- }
- else
- {
- EditForm.editMode.value = 'html';
- htmlRichedit.setHTML('<div><pre>'+EditForm.richedit.value+'</pre></div>');
- htmlView.style.display="";
- textView.style.display="none";
- }
- if(obj.innerText=="可视化编辑器")obj.innerText="文本编辑模式";
- else obj.innerText="可视化编辑器";
- return false;
- }
- function setSend()
- {
- var x,n
- var accessoryValue='<>';
- if(Trim(EditForm.toUser.value)=="")
- {
- alert('请输入收件人');
- EditForm.toUser.focus();
- return false;
- }
- if(EditForm.copyTo.length>=1000)
- {
- alert('邮件最多只能抄送10位接收者!n如要发送给多个人员,请选择多个收件人!');
- EditForm.copyTo.focus();
- return false;
- }
- if(Trim(EditForm.subject.value)=='')
- {
- alert('请输入主题!');
- EditForm.Subject.focus();
- return false;
- }
- // EditForm.accessory.value =accessoryValue;
- if(EditForm.editMode.value=="html")
- EditForm.text.value = '<html>'+htmlRichedit.getHTML()+'</html>';
- else
- EditForm.text.value = EditForm.richedit.value;
- // alert(EditForm.text.value);
- return true;
- }
- var fileCount=1;
- function addRow(objTable){
- var newfirstRow=" <tr><td width="60">附 件 : </td><td><input type="file" name="file0"></td></tr>";
- var tbodyOnlineEdit=objTable.getElementsByTagName("TBODY")[0];
- alert(tbodyOnlineEdit.innerHTML);
- //里面一个附件都没有
- if(tbodyOnlineEdit.innerHTML==""){
- tbodyOnlineEdit.innerHTML=newfirstRow;
- //tbodyOnlineEdit.insertBefore(elm);
- }else{
- var elm = tbodyOnlineEdit.children[0].cloneNode(true);
-
- elm.id="dataRow"+fileCount++;//设置行的ID
- //设置表单name
- elm.children[1].children[0].name="file"+fileCount;
-
- // elm.children[2].children[0].name="amountT"+countId;
- //插入表单
- tbodyOnlineEdit.insertBefore(elm);
- }
- }
- //删除附件
- function deleteRow(objTable,rowid){
- var tbodyOnlineEdit=objTable.getElementsByTagName("TBODY")[0];
- if(rowid!=""){
- for (var i=tbodyOnlineEdit.children.length-1; i>=0 ;i-- ){
-
- if (tbodyOnlineEdit.children[i].id==rowid){tbodyOnlineEdit.deleteRow(i)};
- }
- }
- }
- //设置所以附件路径
- function setFiles(){
- var tbodyOnlineEdit=attachTable.getElementsByTagName("TBODY")[0];
- var ff ="";
- for (var i=tbodyOnlineEdit.children.length-1; i>0 ;i-- ){
- ff += tbodyOnlineEdit.children[i].children[1].children[0].value+"&&";
- }
- ff += tbodyOnlineEdit.children[0].children[1].children[0].value
- EditForm.fs.value=ff;
- }
- //-->
- </script>
- <link href="css/style.css" rel="stylesheet" type="text/css">
- </head>
- <body bgcolor="#F2F1F2" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" scroll="no" background="images/login_bg.gif">
- <div style="overflow: auto;height:100%;width:100%;">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="11" height="11"></td>
- <td ></td>
- </tr>
- </table>
- <table width="100%" height="98%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="11" background="images/1.gif"> </td>
- <td align="center" valign="top" bgcolor="ECF4F5">
- <table width="99%" border="0" >
- <form method="post" enctype="multipart/form-data" name="EditForm" id="EditForm" action="writeMail.do">
- <input type="hidden" name="easyJWebCommand" value="save">
- <input type="hidden" name="subCommand" value="">
- <input name="editMode" type="hidden" id="editMode" value="html">
- <input name="text" type="hidden" id="text" value="">
- <input name="cid" type="hidden" value="">
- <input name="box" type="hidden" value="draftbox">
- <input name="fs" type="hidden" value="">
- <tr>
- <td ><table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr align="center">
- <td width="200" align="center" colspan="2"><font color="#FF0000">收件人、抄送人地址请用逗号隔开</font></td>
- <td width="50" class="coolbutton" style="cursor: hand;" onClick="doSend()" ><img src="images/posts.gif" width="16" height="16" border="0" align="absmiddle">发送</td>
- <td width="50"></td>
- <td width="50" class="coolbutton" style="cursor: hand;" onClick="return doSave();" ><img src="images/copyToDisk0a.gif" width="16" height="16" border="0" align="absmiddle">保存</td>
- <td width="50"></td>
- <td width="90" class="coolbutton" style="cursor: hand;" onClick="doSendAndSave();" ><img src="images/mail.gif" width="16" height="16" border="0" align="absmiddle">发送并保存</td>
- <td width="50"></td>
- </tr>
- <tr>
- <td colspan="1" width="10%" align="center" nowrap class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.toUser);">收件人:</td>
- <td colspan="6" width="90%">
- <% if(replymail!=null){%>
- <input name="toUser" type="text" class="Max" id="toUser" value="<%=replymail.getMail_from()%>">
- <%}else{%>
- <input name="toUser" type="text" class="Max" id="toUser" value="">
- <%}%> </td>
- </tr>
- <tr>
- <td colspan="1" width="10%" align="center" class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.copyTo);">抄 送:</td>
- <td colspan="6" width="90%"><input name="copyTo" type="text" class="Max" id="copyTo" value=""></td>
- </tr>
- <tr>
- <td colspan="1" width="10%" align="center" class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.secretTo);">暗 送:</td>
- <td colspan="6" width="90%"><input name="secretTo" type="text" class="Max" id="secretTo" value=""></td>
- </tr>
- <tr>
- <td colspan="1" width="10%" align="center">主 题:</td>
- <td colspan="6" width="90%"><input name="subject" type="text" class="Max" id="subject" value=""></td>
- </tr>
- <tr>
- <td width="10%" colspan="1" align="center">优先级:</td>
- <td><select name="priority" id="priority" >
- <option value="3" >一般</option>
- <option value="1" >高</option>
- <option value="5" >低</option>
- </select></td>
- <td colspan="2">需要已接收回执
- <input type="checkbox" name="needAutoReply" id="needAutoReply" value="1" > </td>
- <td colspan="2"> </td>
- <td align="center"><a href="#" target="_self" onClick="changeEdit(this);">文本编辑器</a> </td>
- </tr>
- <tr id="htmlView" style="display:">
- <td colspan="7" width="100%"><iframe id='htmlRichedit' name='htmlRichedit' width="100%" height="350" src="include/inedit.htm"></iframe>
- <span id="htmlTempSpan" style="display:none"></span></td>
- </tr>
- <tr id="textView" style="display:none">
- <%if(forwardmail!=null){%>
- <td bgcolor="#C1F9FD" colspan="7" width="100%"><textarea id='richedit' name='richedit' cols="82" rows="19" maxlength="1000000" style="width:100% "><%=forwardmail.getContent()%></textarea></td>
- <%}else{%>
- <td bgcolor="#C1F9FD" colspan="7" width="100%"><textarea id='richedit' name='richedit' cols="82" rows="19" maxlength="1000000" style="width:100% "></textarea></td>
- <%}%>
- </tr>
- <tr>
- <td colspan="7" width="100%">
- <table width="100%" border="0" id="attachTable">
- <tbody>
- <tr id="dataRow0">
- <td width="60">附 件 : </td>
- <td>
- <% if (forwardmail!=null){%>
- <input type="file" name="file0" contenteditable="false" value="<%=forwardmail.getAdds()%>"/>
- <%}else{%>
- <input type="file" name="file0" contenteditable="false" value="<%=forwardmail.getAdds()%>"/>
- <%}%>
-
- <a href="#" onClick="deleteRow(attachTable,this.parentElement.parentElement.id);" >删除附件</a></td>
- </tr>
- </tbody>
- </table> </td>
- </tr>
- <tr>
- <td colspan="7">当前已有附件:
- <input name="addAccessory" type="button" class="TableTitle" style="cursor: hand;" id="addAccessory" value="添加附件"
- onclick="addRow(attachTable);"/>
- 提示:您能发送的邮件附件总容量最大为15M! </td>
- </tr>
- <tr>
- <td colspan="7"> </td>
- </tr>
- </table></td>
- </tr>
- </table></td>
- <td width="11" bgcolor="ECF4F5"> </td>
- </tr>
- </table>
- <script language="javascript">
- if(EditForm.editMode.value!=''&&EditForm.editMode.value=='html')
- {
- window.setTimeout('eee()',500);
- }
- function eee()
- {
- if(EditForm.editMode.value!=''&&EditForm.editMode.value=='html')
- {
- htmlRichedit.setHTML(EditForm.richedit.value);
- }
- }
- window.setTimeout('document.all("toUser").focus()',1);
- </script>
- </div>
- </body>
- </html>