%
dim rs,sql
dim Action,FoundErr,ErrMsg
dim Subject,mailbody
dim ArticleID
dim MailToName,MailToAddress,FromName,MailFrom
dim ObjInstalled
ObjInstalled=IsObjInstalled("JMail.SMTPMail")
ArticleID=request("ArticleID")
Action=trim(request("Action"))
if ArticleID="" then
foundErr = true
ErrMsg=ErrMsg & "
请指定相关文章
"
else
ArticleID=Clng(ArticleID)
end if
if CheckUserLogined()=False then
FoundErr=True
ErrMsg=ErrMsg & " 你还没注册?或者没有登录?只有本站的注册用户才能使用“告诉好友”功能!
"
end if
if foundErr<>True then
sql="Select Title,Content,UpdateTime,Author from article where articleid="&ArticleId&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
FoundErr=True
ErrMsg=ErrMsg & "找不到文章"
else
if Action="MailToFriend" then
call MailToFriend()
else
call main()
end if
end if
rs.close
set rs=nothing
end if
if FoundErr=true then
call WriteErrMsg()
end if
call CloseConn()
sub main()
%>
告诉好友
<%
end sub
sub MailToFriend()
MailToName=trim(request.form("MailToName"))
MailToAddress=trim(request.form("MailToAddress"))
if MailToName="" then
errmsg=errmsg & "
收信人姓名为空!
"
founderr=true
end if
if IsValidEmail(MailToAddress)=false then
errmsg=errmsg & "
收信人的Email地址有错误!
"
founderr=true
end if
if founderr then
exit sub
end if
call GetMailInfo()
FromName=Request.Cookies("asp163")("UserName")
dim trs
set trs=conn_user.execute("select " & db_User_Name & "," & db_User_Email & " from " & db_User_Table & " where " & db_User_Name & "='" & FromName & "'")
MailFrom=trs(1)
set trs=nothing
ErrMsg=SendMail(MailtoAddress,MailtoName,Subject,MailBody,FromName,MailFrom,3)
if ErrMsg="" then
call WriteSuccessMsg("已经成功将此文章发送给你的好友!")
else
FoundErr=True
end if
end sub
sub GetMailInfo()
Subject="您的朋友" & Addressee & "从" & SiteName & "给您发来的文章资料"
mailbody=mailbody &""
mailbody=mailbody &"