write.jsp.svn-base
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:11k
源码类别:

WEB邮件程序

开发平台:

Java

  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <title>发送邮件</title>
  7. <style type="text/css">
  8. <!--
  9. .Max {
  10.  width: 100%;
  11. }
  12. -->
  13. </style>
  14. <script language="JavaScript" src="include/CheckDataFunction.js" type="text/JavaScript"></script>
  15. <script language="javascript">
  16.   <!--
  17.  
  18.  function doSendAndSave()
  19.       {
  20.         if(setSend())
  21. {
  22. EditForm.easyJWebCommand.value="sendSave";
  23.          EditForm.submit();
  24. }
  25. else
  26. return false;       
  27.       }//sendsave 
  28.       function doSend()
  29.       {
  30.         if(setSend())
  31. {
  32. EditForm.easyJWebCommand.value="send";
  33.          EditForm.submit();
  34. }
  35. else
  36. return false;       
  37.       }//sendsave
  38.       function doSave()
  39.       {
  40.         if(setSend())
  41. {
  42. EditForm.easyJWebCommand.value="save";
  43.          EditForm.submit();
  44. }
  45. else
  46. return false;       
  47.       }//sendsave
  48.      
  49.       function choiceAddress(Obj)
  50.       {
  51.         var str='';
  52.         urls="address.ejf?easyJWebCommand=choice";
  53.         str=window.showModalDialog(urls,"addAccessory","dialogWidth:500px;dialogHeight:400px;help:no;status:no");
  54.         choice(Obj,str)
  55.    
  56.       }
  57.       function choice(Obj,str)
  58.       {
  59.         var allValue=Obj.value;
  60. if(str!=null)
  61. {
  62. if(allValue!=null && allValue!="")
  63. {
  64. allValue = allValue+",";
  65. }
  66. var tmpValue='';
  67. var Value=str.split('<>');
  68. for(var x=0;x<Value.length;x++)
  69. {
  70.   if(Value[x]!='')
  71.   {
  72. tmpValue=Value[x].split('|')
  73. if(allValue.indexOf(tmpValue[0])==-1)
  74. allValue+= tmpValue[0]+",";
  75.   }
  76. }
  77. }
  78. Obj.value = allValue.substring(0,allValue.length-1);
  79.       }
  80.       function DelCID(Obj)
  81.       {
  82.         for(var x=Obj.length-1;x>=0;x--)
  83.         {
  84.           if(Obj.options[x].selected)
  85.           {
  86.           Obj.options[x]=null;
  87.           }
  88.         }
  89.       }
  90. function changeEdit(obj)
  91. {
  92. if(EditForm.editMode.value == 'html')
  93. {
  94. if(!window.confirm('警告:如果将该邮件格式改为纯文本,可能会造成格式信息丢失!'))
  95. return false;
  96. EditForm.editMode.value = '1';
  97. EditForm.text.value = htmlRichedit.getPureText();
  98. EditForm.richedit.value= htmlRichedit.getPureText();
  99. htmlView.style.display="none";
  100. textView.style.display="";
  101. }
  102. else
  103. {
  104. EditForm.editMode.value = 'html';
  105. htmlRichedit.setHTML('<div><pre>'+EditForm.richedit.value+'</pre></div>');
  106. htmlView.style.display="";
  107. textView.style.display="none";
  108. }
  109. if(obj.innerText=="可视化编辑器")obj.innerText="文本编辑模式";
  110. else obj.innerText="可视化编辑器";
  111. return false;
  112. }
  113. function setSend()
  114. {
  115.         var x,n
  116.         var accessoryValue='<>';
  117.    if(Trim(EditForm.toUser.value)=="")
  118.         {
  119.           alert('请输入收件人');
  120.           EditForm.toUser.focus();
  121.           return false;
  122.         }
  123.         if(EditForm.copyTo.length>=1000)
  124.         {
  125.           alert('邮件最多只能抄送10位接收者!n如要发送给多个人员,请选择多个收件人!');
  126.           EditForm.copyTo.focus();
  127.           return false;
  128.         }
  129.         if(Trim(EditForm.subject.value)=='')
  130.         {
  131.           alert('请输入主题!');
  132.           EditForm.Subject.focus();
  133.           return false;
  134.         }      
  135.        // EditForm.accessory.value =accessoryValue;
  136. if(EditForm.editMode.value=="html")
  137. EditForm.text.value = '<html>'+htmlRichedit.getHTML()+'</html>';
  138. else
  139. EditForm.text.value = EditForm.richedit.value;
  140. // alert(EditForm.text.value);
  141. return true;
  142. }
  143. var fileCount=1;
  144. function addRow(objTable){
  145.  var newfirstRow=" <tr><td width="60">附 件 : </td><td><input type="file" name="file0"></td></tr>";
  146.  var tbodyOnlineEdit=objTable.getElementsByTagName("TBODY")[0];
  147.  alert(tbodyOnlineEdit.innerHTML);
  148.  //里面一个附件都没有
  149.  if(tbodyOnlineEdit.innerHTML==""){
  150.        tbodyOnlineEdit.innerHTML=newfirstRow;
  151.     //tbodyOnlineEdit.insertBefore(elm);
  152.  }else{
  153.  var elm = tbodyOnlineEdit.children[0].cloneNode(true);
  154.  
  155.  elm.id="dataRow"+fileCount++;//设置行的ID 
  156.  //设置表单name 
  157.  elm.children[1].children[0].name="file"+fileCount;
  158.  
  159. // elm.children[2].children[0].name="amountT"+countId;
  160. //插入表单
  161.  tbodyOnlineEdit.insertBefore(elm);
  162.  }
  163. }
  164. //删除附件
  165. function deleteRow(objTable,rowid){
  166.  var tbodyOnlineEdit=objTable.getElementsByTagName("TBODY")[0];
  167.  if(rowid!=""){
  168.  for (var i=tbodyOnlineEdit.children.length-1; i>=0 ;i-- ){
  169.      if (tbodyOnlineEdit.children[i].id==rowid){tbodyOnlineEdit.deleteRow(i)};
  170.    }
  171.    }
  172. }
  173. //-->
  174. </script>
  175. <link href="css/style.css" rel="stylesheet" type="text/css">
  176. </head>
  177. <body bgcolor="#F2F1F2" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" scroll="no" background="images/login_bg.gif">
  178. <div style="overflow: auto;height:100%;width:100%;">
  179.   <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  180.     <tr>
  181.       <td width="11" height="11"></td>
  182.       <td ></td>
  183.     </tr>
  184.   </table>
  185.   <table width="100%" height="98%"  border="0" cellpadding="0" cellspacing="0">
  186.     <tr>
  187.       <td width="11" background="images/1.gif">&nbsp;</td>
  188.       <td align="center" valign="top" bgcolor="ECF4F5">
  189.           <table width="99%" border="0" >
  190.             <form  method="post" enctype="multipart/form-data" name="EditForm"  id="EditForm"  action="email.ejf">
  191. <input type="hidden" name="easyJWebCommand" value="save">
  192. <input type="hidden" name="subCommand" value="">
  193. <input name="editMode" type="hidden" id="editMode" value="html">
  194.             <input name="text" type="hidden" id="text" value="">
  195. <input name="cid" type="hidden" value="">                 
  196. <input name="box" type="hidden" value="draftbox">                 
  197.               <tr>
  198.                 <td ><table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  199.                   <tr align="center"> 
  200.                     <td width="200" align="center" colspan="2"><font color="#FF0000">收件人、抄送人地址请用逗号隔开</font></td>
  201.                     <td width="50" class="coolbutton" style="cursor: hand;" onClick="doSend()"><img  src="images/posts.gif" width="16" height="16" border="0" align="absmiddle">发送</td>
  202.                     <td width="50"></td>
  203.                     <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>
  204.                     <td width="50"></td>
  205.                     <td width="90" class="coolbutton" style="cursor: hand;" onClick="doSendAndSave();"><img  src="images/mail.gif" width="16" height="16" border="0" align="absmiddle">发送并保存</td>
  206.                     <td width="50"></td>
  207.                   </tr>
  208.                   <tr> 
  209.                     <td colspan="1" width="10%" align="center" nowrap class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.toUser);">收件人:</td>
  210.                     <td colspan="6" width="90%"><input name="toUser" type="text" class="Max" id="toUser" value="">                    </td>
  211.                   </tr>
  212.                   <tr> 
  213.                     <td colspan="1" width="10%" align="center" class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.copyTo);">抄&nbsp;&nbsp;送:</td>
  214.                     <td colspan="6" width="90%"><input name="copyTo" type="text" class="Max" id="copyTo" value=""></td>
  215.                   </tr>
  216.     <tr> 
  217.                     <td colspan="1" width="10%" align="center" class="coolbutton" style="cursor: hand;" onClick="choiceAddress(EditForm.secretTo);">暗&nbsp;&nbsp;送:</td>
  218.                     <td colspan="6" width="90%"><input name="secretTo" type="text" class="Max" id="secretTo" value=""></td>
  219.                   </tr>
  220.                   <tr> 
  221.                     <td colspan="1" width="10%" align="center">主&nbsp;&nbsp;题:</td>
  222.                     <td colspan="6" width="90%"><input name="subject" type="text" class="Max" id="subject" value=""></td>
  223.                   </tr>
  224.                   <tr> 
  225.                     <td width="10%" colspan="1" align="center">优先级:</td>
  226.                     <td><select name="priority" id="priority" >
  227.                         <option value="3" >一般</option>
  228.                         <option value="1" >高</option>
  229.                         <option value="5" >低</option>
  230.                       </select></td>
  231.                     <td colspan="2">需要已接收回执
  232.                       <input type="checkbox" name="needAutoReply" id="needAutoReply" value="1" >                    </td>
  233.                     <td colspan="2">&nbsp;</td>
  234.                     <td align="center"><a href="#" target="_self" onClick="changeEdit(this);">文本编辑器</a>                    </td>
  235.                   </tr>
  236.                   <tr id="htmlView" style="display:"> 
  237.                     <td colspan="7" width="100%"><iframe id='htmlRichedit' name='htmlRichedit' width="100%" height="350" src="include/inedit.htm"></iframe>
  238.                     <span id="htmlTempSpan" style="display:none"></span></td>
  239.                   </tr>
  240.                   <tr id="textView" style="display:none"> 
  241.                     <td bgcolor="#C1F9FD" colspan="7" width="100%"><textarea id='richedit' name='richedit' cols="82" rows="19" maxlength="1000000" style="width:100% "></textarea></td>
  242.                   </tr>
  243.                   <tr> 
  244.                     <td colspan="7" width="100%">
  245. <table width="100%" border="0" id="attachTable">
  246. <tbody>
  247.                         <tr id="dataRow0"> 
  248.                           <td width="60">附 件 : </td>
  249.                           <td><input type="file" name="file0" contenteditable="false"/>
  250.                               <a href="#" onClick="deleteRow(attachTable,this.parentElement.parentElement.id);" >删除附件</a></td>
  251.                         </tr>
  252. </tbody>
  253.                       </table>                    </td>
  254.                   </tr>
  255.                   <tr>
  256.                     <td colspan="7">当前已有附件:
  257.                        <input name="addAccessory" type="button" class="TableTitle" style="cursor: hand;" id="addAccessory" value="添加附件" 
  258.    onclick="addRow(attachTable);"/>
  259.                       提示:您能发送的邮件附件总容量最大为15M! </td>
  260.                   </tr>
  261.                   <tr>
  262.                     <td colspan="7">&nbsp;</td>
  263.                   </tr>
  264.                 </table></td>
  265.               </tr>
  266.             </form>
  267.       </table></td>
  268.       <td width="11" bgcolor="ECF4F5">&nbsp;</td>
  269.     </tr>
  270.   </table>
  271. <script language="javascript">
  272. if(EditForm.editMode.value!=''&&EditForm.editMode.value=='html')
  273. {
  274. window.setTimeout('eee()',500);
  275. }
  276. function eee()
  277. {
  278. if(EditForm.editMode.value!=''&&EditForm.editMode.value=='html')
  279. {
  280. htmlRichedit.setHTML(EditForm.richedit.value);
  281. }
  282. }
  283. window.setTimeout('document.all("toUser").focus()',1);
  284. </script>  
  285. </div>
  286. </body>
  287. </html>