<!--#include file="inc/conn.asp"-->
<!--#include file="inc/safe.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/const.asp"-->
<%
if MemberName="" then
  response.Redirect("userlogin.asp")
  response.end
end if
%>
<%
dim errmsg
errmsg=""

dim title,content,receiver,receiverid

title=trim(ReplaceBadChar(request.Form("title")))
content=convert(request.Form("content"))
receiver=request.Form("receiver")


'on error resume next
set rs=server.CreateObject("adodb.recordset")
sql="select userid from user_info where username='"& receiver &"'"
rs.open sql,conn,1
if rs.eof or rs.bof then
  errmsg=errmsg+"<br><li>没有找到收信人，请确认收信人帐号填写是否正确！"
else
   receiverid=rs("userid") 
end if 
rs.close
set rs=nothing

if title="" then errmsg=errmsg+"<br>"+"<li>文章的标题不能为空！"
if invalidch(title) or instr(title,"，")>0  then errmsg=errmsg+"<br>"+"<li>您的标题可能含特殊符号，请检查！"
if len(content)>3000 then errmsg=errmsg+"<br><li>邮件内容不能超过3000字！"

if errmsg<>"" then 
 response.Write "<table width=400 align=center><tr><td height=25 style='font-size:12px'>错误信息：</td></tr>"
 response.write("<tr><td style='font-size:12px'>"+ errmsg +"<br></td></tr>")
 response.Write "<tr><td align='center'><input type='button' value='返回修改' onClick='javascript:window.history.back();'>"
 response.Write "<input type='button' value='关闭窗口' onClick='javascript:window.close();'></td></tr></table>"
 response.end
end if

set rst=server.CreateObject("adodb.recordset")   
sql1="select * from sd_ly where id is null"
rst.open sql1,conn,1,3
rst.addnew
rst("userid")=receiverid
rst("title")=title
rst("content")=content
rst("addtime")=now()
rst("postid")=userid
rst("postname")=MemberName
rst("isread")=0
rst.update
rst.close
set rst=nothing

conn.close
set conn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>邮件发送成功</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta HTTP-EQUIV=refresh Content='1;url=send_mail.asp'>
</head>

<table border="0" cellspacing="0" width="100%" cellpadding="0" height="418" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="100%" height="418" valign="middle" align="center" class="STYLE4">
<b>您邮件信息已经提交发送！<a href="send_mail.asp"><font color="#996633">返回</font></a></b></td>
</tr>
</table>
</body>
</html>