<!--#include file="../Conn.asp"-->
<!--#include file="../inc/Cl_ClsSysTem.asp"-->
<!--#include file="../inc/Cl_ClsEmail.asp"-->
<%
'if Cl.ChkIsOuter Then
	'Cl.OutErr("<li>请不要从外部或者直接访问本页面！</li>")
	'Response.end
'end if
Cl.GetWeb_Setting
dim rs,sql
dim Action,FoundErr,ErrMsg
dim SendTitle,SendBody,MailBody,sTempBody
dim MailTitle,MailUrl,ComeUrl
dim InfoID,ChannelID
dim FriendName,FriendEmail,FromName
dim ObjInstalled
if Not Cl.ChkUserLogin then
	Cl.OutErr(Cl.NotLoginErr(4,"告诉好友"))
	Response.end
end if
Select Case Cint(Cl.Web_Setting(17))
Case 1
ObjInstalled=Cl.ChkObjInstalled("JMail.Message")
Case 2
ObjInstalled=Cl.ChkObjInstalled("CDONTS.NewMail")
Case 3
ObjInstalled=Cl.ChkObjInstalled("Persits.MailSender")
Case Else
ObjInstalled=False
End Select
if ObjInstalled=False then
	Cl.OutErr("<li><font color=red>对不起，因为服务器不支持未安装邮件发送组件，或者已禁用发送邮件功能!</font></li>")
end if

InfoID=request("InfoID")
Action=Trim(request("Action"))
MailTitle=Trim(request("Title"))
MailUrl=Trim(request.Form("MailUrl"))
ComeUrl=Request.ServerVariables("HTTP_REFERER")
if ComeUrl="" then ComeUrl=Cl.Web_Info(4)
if MailUrl="" then MailUrl=ComeUrl
Cl.LoadTemplates("index")
sTempBody=Split(Template.html(15),"||")
MailBody=Replace(sTempBody(0),"{%webname%}",Cl.Web_Info(0))
MailBody=Replace(MailBody,"{%mailtitle%}",MailTitle)
MailBody=Replace(MailBody,"{%mailurl%}",MailUrl)
MailBody=Replace(MailBody,"{%username%}",Cl.User_Info(5))
MailBody=Replace(MailBody,"'","")
MailBody=Replace(MailBody,vbcrlf,"<br>")
if Action="SendMail" then
	SendToFriend
else
	SendMain
end if

Sub SendMain()
MailBody=Replace(MailBody,"{%fromname%}",Cl.User_Info(5))
%>
<HTML>
<HEAD>
<TITLE>告诉好友</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style type="text/css">
A{TEXT-DECORATION: none;}
A:hover{COLOR: #0099FF;}
A:link {color: #205064;}
A:visited {color: #006699;}
BODY{
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt;
text-decoration: none;
line-height: 150%;
background-color: #FBFDFF;}
TD{
FONT-FAMILY:宋体;
FONT-SIZE: 9pt;}
Input{
FONT-SIZE: 9pt;
HEIGHT: 20px;}
Button{
FONT-SIZE: 9pt;
HEIGHT: 20px; }
Select{
FONT-SIZE: 9pt;
HEIGHT: 20px;}
.border{border: 1px solid #CCCCCC;}
.border2{
background:#fef8ed;
BORDER-RIGHT: #999999 1px solid; 
BORDER-LEFT: #999999 1px solid}
.title{background:#f6f6f6;}
</style>
</head>
<body>
<form action="SendMail.asp" method="post" Name="Form1">
  <table cellpadding=2 cellspacing=1 border=0 width=700 class="border" align=center>
    <tr>
      <td height="22" colspan=2 align=center valign=middle class="title"> <b>将本页面告诉好友</b><br>(<font color="#0000FF"><%=ComeUrl%></font>)</td>
    </tr>
    <tr class="tdbg">
      <td width="120" align="right"><strong>收信人姓名：</strong></td>
      <td><input name="FriendName" type="text" id="FriendName" size="60" maxlength="20" onkeyup="NewsMailBody(this.value);"> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg">
      <td width="120" align="right"><strong>收信人Email：</strong></td>
      <td><input name="FriendEmail" type=text id="FriendEmail" size="60" maxlength="100"> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg">
      <td width="120" align="right"><strong>发送人姓名：</strong></td>
      <td><input name="FromName" type="text" id="FromName" size="60" maxlength="20" value="<%=Cl.User_Info(5)%>"> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg">
      <td width="120" align="right"><strong>发送人Email：</strong></td>
      <td><input name="FromEmail" type=text id="FromEmail" size="60" maxlength="100" value="<%=Cl.User_Info(8)%>" readonly> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg">
      <td width="120" height="60" align="right"><strong>发送主题：</strong></td>
      <td height="60"><input name="SendTitle" type="text" id="SendTitle" size="88" maxlength="200" value="<%=Replace(Template.Strings(12),"{%webname%}",Cl.Web_Info(0))%>" readonly></td>
    </tr>
    <tr class="tdbg">
      <td width="120" height="60" align="right"><strong>发送内容：</strong></td>
      <td height="120"><div class=border><span Id=MailBody><%
	  Response.write Replace(MailBody,"{%friendname%}","***")
	  %></span></div></td>
    </tr>
    <tr class="tdbg">
      <td colspan=2 align=center><input name="Action" type="hidden" id="Action" value="SendMail">
	  <input name="Title" type="hidden" id="Title" value="<%=MailTitle%>"> 
	  <input name="MailUrl" type="hidden" id="MailUrl" value="<%=ComeUrl%>">
        <input type=submit value=" 发 送 " name="Submit">
      </td>
    </tr>
  </table>
</form>
</BODY>
</HTML>
<script Language=JavaScript>
function NewsMailBody(Val){
	var obj = MailBody;
	if (obj){
		var str='<%=MailBody%>';
		if (Val!=''){
			obj.innerHTML = str.replace('{%friendname%}',Val.toLowerCase());
		}else{
			obj.innerHTML = str.replace('{%friendname%}','***');
		}
	}
}
</script>
<%
end sub

sub SendToFriend()
	FriendName=Trim(request.Form("FriendName"))
	FriendEmail=Trim(request.Form("FriendEmail"))
	FromName=Trim(request.Form("FromName"))
	if FriendName="" then
		errmsg=errmsg & "<br><li>收信人姓名不能为空！</li>"
		founderr=true
	end if
	if Not Cl.ChkEmail(FriendEmail) then
   		errmsg=errmsg & "<br><li>收信人的Email地址有错误！</li>"
   		founderr=true
	end if
	if FromName="" then
		errmsg=errmsg & "<br><li>发信人姓名不能为空！</li>"
		founderr=true
	end if
	if founderr then
		Cl.OutErr(errmsg)
		exit sub
	end if
	MailBody=Replace(MailBody,"{%fromname%}",FromName)
	MailBody=Replace(MailBody,"{%friendname%}",FriendName)
	'sTempBody(1)=Replace(sTempBody(1),"{%mailbody%}",MailBody)
	SendBody=Replace(sTempBody(1),"{%mailbody%}",MailBody)
	SendBody=Replace(SendBody,"{%webname%}",Cl.Web_Info(0))
	SendBody=Replace(SendBody,"{%copyright%}",Cl.Web_info(9))
	SendBody=Replace(SendBody,"{%version%}","<a href='http://www.c"&"lwang.net' target='_blank'>"&Cl.Web_Version(1)&"</a>")
	'Response.write SendBody
	Dim ClEmail
	Set ClEmail = New Cls_SendMail
	ClEmail.SendObject = Cint(Cl.Web_Setting(17))	'设置选取组件
	ClEmail.ServerLoginName = Cl.Web_Setting(19)	'您的邮件服务器登录名
	ClEmail.ServerLoginPass = Cl.Web_Setting(20)	'登录密码
	ClEmail.SendSMTP = Cl.Web_Setting(18)			'SMTP地址
	ClEmail.SendFromEmail = Cl.User_Info(8)		'发送来源地址
	ClEmail.SendFromName = FromName		'发送人信息
	If ClEmail.ErrCode = 0 Then
		ClEmail.SendMail FriendEmail,MailTitle,SendBody	'执行发送邮件
	End If
	If ClEmail.ErrCode <> 0 Then
		Cl.OutErr(ClEmail.Description)
	else
		Cl.OutMsg "恭喜您，已经成功将此邮件发送给你的好友！",MailUrl
	end if
end sub
%>
<%
'===================================================
' CreateLive CMS Version 3.1
'							Powered by Aspoo.CoM
'===================================================
' Mail: aspoo@126.com, Info@aspoo.cn
' Q  Q: 3315263, 596197794
' Msn : aspoo@126.com, Clw866@hotmail.com
' Web : http://www.aspoo.com, http://www.aspoo.net
' Bbs : http://bbs.aspoo.com, http://bbs.aspoo.net
' Copyright (C) 2005 Aspoo.CoM All Rights Reserved.
'===================================================
%>