<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<%
	useflag=4
%>
<!--#include file="flag.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	if Trim(Request.QueryString("action"))="add" then
		if trim(request("title"))="" then
			response.write "<script language=JavaScript>" & "alert('主题不能为空！');" & "history.back()" & "</script>" 
			Response.End
		end if
		if trim(request("content"))="" then
			response.write "<script language=JavaScript>" &  "alert('信息内容不能为空！');" & "history.back()" & "</script>" 
			Response.End
		end if
		set rs = server.CreateObject("adodb.recordset")
		sql="insert into pmailbox(senduid,reid,sendname,mailtext,title,sdate) values('0',"&request("tid")&",'系统管理员','"&request("content")&"','"&request("title")&"',date())"
		rs.open sql,conn,2,3
		set rs=nothing
		
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select * from sendmail"
		rs.open sql,conn,1,1
		if rs("open1")=0 then
			mailaddress=rs("mailaddress")
			mailusername=rs("mailusername")
			mailuserpass=rs("mailuserpass")
			mailsend=rs("mailsend")
		
		
			'发送邮件
			On Error Resume Next
			'发送推荐邮件
			topic=Trim(Request.Form("title"))
			
			mailbody="<html>"
			mailbody=mailbody & "<title>职位推荐信息</title>"
			mailbody=mailbody & "<body>"
			mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
			mailbody=mailbody & "<TD valign=middle align=top>"
			mailbody=mailbody & Trim(Request.Form("content"))
			mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
			mailbody=mailbody & "</body>"
			mailbody=mailbody & "</html>"
			rs.close
			
			Set JMail=Server.CreateObject("JMail.Message")
			JMail.Charset="gb2312"
			JMail.ContentType = "text/html"
			jmail.from = mailsend
			jmail.silent = true
			jmail.Logging = true
			jmail.FromName = topic
			jmail.mailserverusername = mailusername
			jmail.mailserverpassword = mailuserpass
			jmail.AddRecipient Trim(Request.Form("email"))
			jmail.body=mailbody
			JMail.Subject=topic
			if not jmail.Send ( mailaddress ) then
				SendMail=""
			else
				SendMail="OK"
			end if
			if SendMail="OK" then
				sendmsg="您的推荐信息已经发往您的邮箱，请注意查收!"
			else
				sendmsg="系统出错，推荐信息资料未能发送到您的邮箱!"
			end if
				response.write"<SCRIPT language=JavaScript>alert('"&sendmsg&"');"
				response.write"javascript:window.close();</SCRIPT>"
		else
			rs.close
			response.write"<SCRIPT language=JavaScript>alert('系统暂时关闭邮件发送功能，推荐信息资料未能发送到您的邮箱');"
			response.write"javascript:window.close();</SCRIPT>"
			response.end
		end if
	end if
'邮件发送代码完毕
	set rs = server.CreateObject("adodb.recordset")
	sql="select * from person where id="&Trim(Request.QueryString("tid"))
	rs.open sql,conn,1,1
	if rs.recordcount=0 then
		rs.close
		set rs=nothing
		response.write "<script language=JavaScript>" &  "alert('非法数据提交！');" & "window.close()" & "</script>" 
		Response.End
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>标签类型</title>
</head>
<link href="Include/ModeWindow.css" rel="stylesheet">
<script language="JavaScript" src=Include/"Common.js"></script>
<body  topmargin="0" leftmargin="0">
<br>
<form name="Form" method="post" action="?action=add">
<input type="hidden" name="email" value="<%=rs("email")%>">
<input type="hidden" name="tid" value="<%=request("tid")%>">
<table width="93%" border="0" align="center" cellpadding="3" cellspacing="1" class='border'>
  <tr class='title'>
    <td colspan=2 align=center height=25>委托招聘通过面试通知</td>
  </tr>
  <tr class='tdbg'>
    <td width="378" height="30" align="right">收件人ID:</td>
    <td width="530" height="30"><%=rs("uname")%></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">信件标题:</td>
    <td height="30"><input  name="title" class='textbox' value="委托招聘通过面试通知" size="35"></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">信件内容:</td>
    <td><textarea name="content" cols="60"  rows="8" class='textbox'>您在本站申请的面试请求已经受理，请您在 年 月 日 时准时到 参加面试，如果您对此有任何疑问，请拨打我们24小时的服务电话：    ，感谢您一直以来的支持！您可以通过以下地址浏览到职位的相关信息<a href="<%=GetURL%>view_wtzp.asp?id=<%= Trim(Request.QueryString("jobid")) %>" target="_blank"><%=GetURL%>view_wtzp.asp?id=<%= Trim(Request.QueryString("jobid")) %></a></textarea></td>
  </tr>
</table>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="40" align="center"><input type="submit" name="Submit" class='textbox' value=" 确 定 ">        
<input type="button" name="Submit2" class='textbox' onClick="window.close()" value=" 取 消 "></td>
</tr>
</table>
</form>
</body>
</html>
<%
	rs.close
	set rs=nothing

	function GetURL()
		dim url1,url2,url
		url1 = Request.ServerVariables("server_name")
		leng=len(Request.ServerVariables("path_info"))
		leng1=leng-19
		url2 = left(Request.ServerVariables("path_info"),leng1)
		url="http://"&url1&url2
		GetURL = url
	end function
%>