<!--#include file="../../oa/SQLconn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存邮件文件</title>

<link rel="stylesheet" type="text/css" href="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>
</head>
<body  topmargin="5" leftmargin="5">

<p>
<%
		 
		 
		APPID=request("APPID") 
		title=request("title")
		sendto=request("sendto")
		rbnchaosong=request("rbnchaosong")
		checkboxDuanxin=request("checkboxDuanxin")
		content=request("content")
		Tname=request("Tname")
	 

 


				dim rsgonggaosql
				dim rsgonggao
				
				dim filename
				
				'dim strtype 
				dim strdateandtime
				if  dateandtime<>"" then
				   strdate=cdate(dateandtime)
				else  
				   strNow=now()
				 end if
				 
				 
				 
				'检查				 
					  set rscheck=server.createobject("adodb.recordset")
					  rscheckSQL="select * from teachers where APPID='"&APPID&"'" 
					  rscheck.open rscheckSQL,conn,1,3
					  if  rscheck.eof and  rscheck.bof then
				     		response.end
					  end if 
				 
				 
				 
				 
				'取得最后一个ID   从存储过程取得gonggaoid
				
							dim fid 
							Set cmd = server.CreateObject("ADODB.Command")
							set Cmd.ActiveConnection = conn
							with Cmd
							   .CommandText = "incid"
							   .CommandType = 4
							   .parameters.Refresh
							   .parameters("@name") ="AllID"
							   .execute
							   fid = .parameters("@id")
							end with
				
				'发送文件到数据库
				set rsgonggao=server.createobject("adodb.recordset")
				rsgonggaosql="select * from email where (id is null)" 
				rsgonggao.open rsgonggaosql,conn,1,3
				rsgonggao.addnew
				
				rsgonggao("id")=fid
				rsgonggao("sendto")=sendto
				rsgonggao("title")=title
				rsgonggao("content")=content
				rsgonggao("Author")=tname
				rsgonggao("updateandtime")=strdate
				
				rsgonggao("iscaogao")="0"    '标志为草稿
				
				
				rsgonggao("isChaoSong")="1" 
				
				rsgonggao("updatetime")=now()
				rsgonggao("upname")=tname
				strip=Request.ServerVariables("REMOTE_ADDR")
				rsgonggao("upip")=strip
				rsgonggao.update
				rsgonggao.close
				
				
				 			 
				 



				if sendto<>"" then
				
				'标记发送文件给个人
				set rssended=server.createobject("adodb.recordset")
				rssendedsql="select * from emailsee where (sid is null)" 
				rssended.open rssendedsql,conn,1,3
				
				dim mysendto
				mysendto=split(sendto,"|",-1,1)
				for each sendtoinf in mysendto
					
					set Rscheck=Conn.Execute("select * from emailsee where  fid='"&fid&"' and  ShouName='"&sendtoinf&"'")
					if   Rscheck.eof and   Rscheck.bof then  '检查是否重发
							rssended.addnew
							rssended("fid")=fid
							rssended("ShouName")=sendtoinf
							if checkboxDuanxin="1" then 
								rssended("短信提醒")="已短信提醒"
							end if
							rssended.update
					end if
				next
				
				
				rssended.close
				end if 


              Upload.Dispose ' 释放内存 
              Set Upload = Nothing 

              conn.close

             Set MyOAASPObj = Server.CreateObject("YFSchoolOApro.YFSchoolDll")
           call  MyOAASPObj.SendToOAJingLing("邮件",fid)
		     set MyOAASPObj=nothing
			 
			 
			  '发送短信到手机
    if checkboxDuanxin="1" then
        Set MyOAASPObj = Server.CreateObject("YFSchoolOApro2.YFSchoolDll2")
        call     MyOAASPObj.EmailSendtoPhone(fID,title,request.cookies("tname"))
        set MyOAASPObj=nothing
	end if


         
%>

 
<div align="center">
  已经成功发送
</div>
 
</body>  
  
</html>  


