📄 writemail.asp
字号:
<!--#include file="check.asp"-->
<!--#include file="connect.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%if Request.ServerVariables("Request_Method")="POST" and request("flag")="1" then
set bzwb=server.createobject("oaserver.writemail")
bzwb.main(conn)
response.write("<script language=javascript>alert('邮件发送成功!');document.location='right.asp'</script>")
response.end
end if
LocalFile="writemail.asp"
NameFile="mailfjname.asp" '上传文件的文件名
Fj="mailfj.asp"
FjDel="mailfjdel.asp" '如果上传附件失败删除临时文件
HttpUrl="http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
HttpUrl=Left(HttpUrl,Len(HttpUrl)-Len(LocalFile))
FjUrl=HttpUrl & Fj
NameUrl=HttpUrl & NameFile
FjDelUrl=HttpUrl & FjDel
%>
<script language="JavaScript" src="swfj.js"></script>
<script language="JavaScript" src="fawen.js"></script>
<script language=javascript>
var upfj;
upfj=0; //上传附件没有错误
//--------------------------------send fujian file------------------------------
function sendfj(fileid){
var NameUrl="<%=NameUrl%>" //保存公文文件url路径
var FjUrl="<%=FjUrl%>" //保存附件文件url路径
var FjDelUrl="<%=FjDelUrl%>" //上传失败删除临时文件
var MaxSize="<%=session("MaxSize")%>" //限制上传附件文件的大小
var fileform = document.form;
PsoPath=fileform.elements[fileid].value
//PsoPath=document.form.filefj0.value
PsoFile=PsoPath //定义附件的文件名
PsoType=""
while(PsoFile.indexOf("\\")>0) //获得附件的文件名
{
i = PsoFile.indexOf("\\")
PsoFile = PsoFile.substring(i + 1, PsoFile.length);
} //获得附件的文件名
PsoPath=PsoPath.substring(0,PsoPath.lastIndexOf("\\")) //获得附件的路径
PsoType=PsoFile
if (PsoType.lastIndexOf(".")>0) //获得附件的扩展名
{
i = PsoType.lastIndexOf(".")
PsoType = PsoType.substring(i + 1, PsoType.length);
}
result=form.web.upload(FjUrl,PsoFile,PsoPath,MaxSize) //向服务器上传附件
//document.form.fujian.value=PsoFile
if (!result)
{
result=form.web.sendurl(FjDelUrl,"",""); //删除前面上传的临时文件
alert("上传附件失败或附件不存在!");
fileform.elements[fileid].focus();
upfj=1;
return false; //上传附件失败,返回起草公文页面
}
else{
result=form.web.sendurl(NameUrl,PsoFile,PsoType)
}
}
//------------------end function-------------------------------------------------------
function checkform() {
upfj=0;
if (form.text.value.length>590) {
form.text.focus()
alert("您邮件内容不能超过600字")
return false;
}
if (form.username.value=="") {
alert("请选择收件人!")
form.username.focus()
return false
}
if (form.title.value=="") {
alert("你的邮件没有写标题!")
form.title.focus()
return false;
}
//-------发送附件
var fileform = document.form; //调用上传附件函数
for ( var i= 0 ; i <fileform.elements.length ; i ++ ) {
if ( fileform.elements[i].type == "file" && fileform.elements[i].name !="file" ) {
if (fileform.elements[i].value!="") {
sendfj(i);
if(upfj==1) return false;
}
}
}//for
//--------发送附件
document.form.submit()
return false;
}
</script>
<link rel="stylesheet" href="mail.css" type="text/css">
<style>
.fontchoose {
cursor:hand;FONT-SIZE: 9pt; COLOR: #395798; LINE-HEIGHT: 18pt; FONT-FAMILY: 宋体
}
.workshop {
cursor:hand;FONT-SIZE: 10pt; COLOR: #395798; LINE-HEIGHT: 18pt; FONT-FAMILY: 宋体
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="form" method="post" action="">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td height="283" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="26">
<tbody>
<tr>
<td width="100%" background="images/emailt.gif" class="9blue"> 撰写新邮件,从右边选择收件人!</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="34" background="images/email10.gif">
<tbody>
<tr>
<td width="65" align="center"> <a href="#" onClick="return checkform();" class="wlink">发
送</a> </td>
<td width="6"><img src="images/email12.gif" width="6" height="33"></td>
<td width="65" align="center"> <a href="mailbox.asp" class="wlink">收邮件</a></td>
<td width="6"><img src="images/email12.gif" width="6" height="33"></td>
<td width="65" align="center"><a href="right.asp" class="wlink">首
页</a></td>
<td width="6"><img src="images/email12.gif" width="6" height="33"></td>
<td width="65" align="center"> <a href="#" onClick="javascript:history.go(-1)" class="wlink">返
回</a></td>
<td> </td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="60" bgcolor="88CCEF">
<tr>
<td width="11%" align="right" height="31">收件人:</td>
<td width="89%" height="31">
<input type="text" name="username" style="width:100%" readonly value="<%=request("uid")%>">
</td>
</tr>
<tr>
<td width="11%" height="30" align="right">标 题:</td>
<td width="89%" height="30">
<input type="text" name="title" style="width:100%">
</td>
</tr>
<tr>
<td width="11%" height="30" align="right">附 件:</td>
<td width="89%" height="30">
<span id="idfilespan"></span>
<a href="javascript:;" name="attach" id="attach" onclick="add();this.childNodes[0].nodeValue='添加附件';" title="如果您要发送多个附件">添加附件</a>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
<tbody>
<tr>
<td width="100%" bgcolor="#BADCFC"> </td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="100%">
<textarea name="text" style="width:100%;height:230px" class="body1" rows="1" cols="20"></textarea>
</td>
</tr>
</tbody>
</table>
</td>
<td width="200" valign="top">
<%
set bzwb=server.createobject("oaserver.turnmore")
bzwb.main(conn)
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="flag" value="1">
<input type="hidden" name="hiddenselect" value="1">
<object width="1" height="1" classid="clsid:8C9AA244-AC33-47F9-8968-CC114654A6EC" codebase="web.ocx" id="web"></object>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -