<!-- #include file="include/config_other.asp" -->
<!-- #include file="include/conn.asp" -->
<%
dim fromwho,towho,subject,body,num,iterror,topic,nsort,url,login_name,fname,femail,username,email,remark
tit="推荐给好友"


call web_head(3,0,4,0,0)
topic = TRIM( Request( "topic" ) )
nsort = TRIM( Request( "nsort" ) )
url = TRIM( Request( "url" ) )


sub sendmail( fromWho, toWho, Subject, Body )
     dim mymail
	set mymail = Server.CreateObject("CDONTS.Newmail")
	mymail.From = fromWho
	mymail.To = toWho
	mymail.Subject = Subject
	mymail.Body = Body
	mymail.Send
	set mymail = Nothing
end sub


fname = TRIM( Request.Form( "fname" ) )
femail = TRIM( Request.Form( "femail" ) )
remark = TRIM( Request.Form( "remark" ) )
username = TRIM( Request.Form( "username" ) )
email = TRIM( Request.Form( "email" ) )

Subject = ""&web_var(web_config,1)&" - 推荐给好友 - "&topic&""
toWho = femail
fromWho = email
Body =vbcrlf& "注：本邮件为您的好友（"&username&"）推荐给你的信息！"
Body =Body&vbcrlf& "===================================================="
Body =Body&vbcrlf& "亲爱的"&fname&"，你好！"

Body =Body&vbcrlf& "我最近在网上看一较好的地方，你可以看一下："
Body =Body&vbcrlf& ""&web_var(web_config,1)&" -- "&nsort&""
Body =Body&vbcrlf& "相关标题："&topic&""
Body =Body&vbcrlf& "相关地址："&url&"n\n"
Body =Body&vbcrlf& "以下是您的好友给您的附言："
Body =Body&vbcrlf& "-------------------------------------------------------"
Body =Body&vbcrlf& ""&remark&""
Body =Body&vbcrlf& "-------------------------------------------------------"
Body =Body&vbcrlf& "你的朋友："&username&""
Body =Body&vbcrlf& "电子邮件："&email&""

Body =Body&vbcrlf& "--------------------------------------------------------"
Body =Body&vbcrlf& "更多精彩信息请访问："
Body =Body&vbcrlf& ""&web_var(web_config,1)&""
Body =Body&vbcrlf& ""&web_var(web_config,2)&""
Body =Body&vbcrlf& "欢迎您的光临！"

if toWho <> "" then
     sendMail fromWho, toWho, Subject, Body
response.write"<script language=javascript>alert(""您已成功为您好友("&fname&")推荐一条信息！点击关闭......……"");window.close();</script>"
response.end
end if
%>
<script language="javascript">

function allowsend(udform)
{
var torf,torf1,torf2,torf3

var str1=udform.femail.value


var strlen1=str1.length

var atplace1=str1.match("@")

 if (strlen1>0)
  {

          if (!atplace1 || strlen1<5)
             {  
           alert("email填写不正确！")
           torf1=false     
             }
          else 
           {
            torf1=true
            }

    }

  else 
 {
alert ("请输入你要发送到的地址！")
 torf1=false
  }
return torf1
}
</script>
<%
  sql="select * from user_data where username='"&login_username&"'"
  set rs=conn.execute(sql)
%>
<center>
<table width='100%' height=2><tr><td></td></tr></table>
<table border=1 width='98%' cellspacing=1 cellpadding=1 bgcolor=<%=web_var(web_color,2)%> bordercolor=<%=web_var(web_color,1)%>>
<form name="sendmail" action='?action=send&nsort=<%=nsort%>&topic=<%=topic%>&url=<%=url%>' method=post  onsubmit="return allowsend(sendmail)">
<tr bgcolor=<%=web_var(web_color,2)%> bordercolor=<%=web_var(web_color,2)%>><td class=end align=center colspan=2><b>推荐给好友</b></td></tr>
<tr bgcolor=<%=web_var(web_color,1)%> bordercolor=<%=web_var(web_color,1)%>>
<td align=center width='20%'>推荐栏目：</td><td width='80%' class=blue><b><%=nsort%>&nbsp;</b></td>
</tr>
<tr bgcolor=<%=web_var(web_color,1)%> bordercolor=<%=web_var(web_color,1)%>>
<td align=center>推荐标题：</td><td class=red_3><%=topic%>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,5)%> bordercolor=<%=web_var(web_color,5)%>>
<td align=center>好友姓名：</td><td><input type=text name=fname size=20 maxlength=20>&nbsp;<font color='#ff0000'>*</font>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,5)%> bordercolor=<%=web_var(web_color,5)%>>
<td align=center>好友邮件：</td><td><input type=text name=femail size=50 maxlength=50>&nbsp;<font color='#ff0000'>*</font>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,5)%> bordercolor=<%=web_var(web_color,5)%>>
<td align=center>推荐附言：</td><td><textarea name=remark rows=6 cols=50></textarea>&nbsp;<font color='#ff0000'>*</font>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,1)%> bordercolor=<%=web_var(web_color,1)%>>
<td align=center>您的姓名：</td><td><input type=text name=username value='<%=login_username%>' size=20 maxlength=20>&nbsp;<font color='#ff0000'>*</font>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,1)%> bordercolor=<%=web_var(web_color,1)%>>
<td align=center>您的邮件：</td><td><input type=text name=email value='<%=rs("email")%>' size=50 maxlength=50>&nbsp;<font color='#ff0000'>*</font>&nbsp;</td>
</tr>
<tr bgcolor=<%=web_var(web_color,5)%> bordercolor=<%=web_var(web_color,5)%>>
<td align=center>&nbsp;</td><td height=35>&nbsp;&nbsp;<input type=submit value='立即发送'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset value='重新填写'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:self.close()'>『关闭窗口』</a></td>
</tr>
</form>
</table>
<% rs.close:set rs=nothing %>