📄 classmaillist.asp
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<!--#INCLUDE FILE="email.asp" -->
<%locat="班级邮件组"
if membername="" then
errmsg=errmsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
call top(1,1)
call error("Information",errmsg)
else
joinstatus=chkjoinclass(clsid)
if joinstatus<>"" then
call top(1,1)
call error("Exclamation",joinstatus)
else
call top(2,1)
if request("action")="sendmail" then
call sendmail()
else
call writelettle()
end if
end if
end if
sub writelettle()
dim rs
set rs=conn.Execute("select email from student where userid='"&membername&"'")
%>
<SCRIPT language=Javascript>
<!--
function sendmail_submit(obj){
temp=document.sendmail.from.value;
if(document.sendmail.Subject.value.length==0)
{
alert("主题不能为空!");
document.sendmail.Subject.focus();
return false;
}
if ((temp.indexOf("@")==-1) || (temp.indexOf("@")!=temp.lastIndexOf("@")) || temp.indexOf("@")==temp.length-1)
{
alert("Email地址格式不正确!");
document.sendmail.from.focus();
return false;
}
var count;
count=document.sendmail.sendmail.length;
if (count==0)
{
alert("您没有选择给谁发信!");
return false;
}
if(document.sendmail.Content.value.length==0)
{
alert("Email正文不能为空!");
document.sendmail.Content.focus();
return false;
}
for (i=0;i<count;i++)
{
document.sendmail.sendmail[i].selected=true;
}
document.sendmail.submit.disabled=true
initAd();
}
function selectall(){
var sendcount,allcount;
var optmail;
sendcount=document.sendmail.sendmail.length;
for(i=0;i<sendcount;i++)
{
document.sendmail.sendmail.remove(0);
}
allcount=document.sendmail.allmail.length;
for(i=0;i<allcount;i++)
{
optmail=document.createElement("option");
optmail.text=document.sendmail.allmail[i].text;
optmail.value=document.sendmail.allmail[i].value;
document.sendmail.sendmail.add(optmail);
}
for(i=0;i<allcount;i++){
if(document.sendmail.allmail[i].selected==true){
document.sendmail.allmail[i].selected=false;
}
}
}
function addmail(){
var allcount,sendcount,flag1,flag2;
var optmail;
allcount=document.sendmail.allmail.length;
sendcount=document.sendmail.sendmail.length;
flag1=0;
flag2=0;
for(i=0;i<allcount;i++){
if(document.sendmail.allmail[i].selected==true){
document.sendmail.allmail[i].selected=false;
for(j=0;j<sendcount;j++){
if(document.sendmail.allmail[i].value==document.sendmail.sendmail[j].value)
{
alert("您选择的Email已经存在了!");
flag1=1;
}
}
if(flag1==0)
{
flag2=1;
optmail=document.createElement("option");
optmail.text=document.sendmail.allmail[i].text;
optmail.value=document.sendmail.allmail[i].value;
document.sendmail.sendmail.add(optmail);
}
}
if(flag1==1)break;
}
if(flag2==0){
if (flag1==0)
{
alert("请选择要添加的Email!")
}
}
}
function delmail(){
var sendcount,flag,delcount;
var optmail;
flag=0;
delcount=0;
sendcount=document.sendmail.sendmail.length;
for(i=0;i<sendcount;i++){
if(document.sendmail.sendmail[i].selected==true){
flag=1;
for(j=i;j>0;j--)
{
document.sendmail.sendmail[j].value=document.sendmail.sendmail[j-1].value;
document.sendmail.sendmail[j].text=document.sendmail.sendmail[j-1].text;
}
delcount=delcount+1;
}
}
if (flag==0)
{
alert("请选择要删除的Email!");
}
for(i=0;i<delcount;i++)
{
document.sendmail.sendmail.remove(0);
}
for(i=0;i<document.sendmail.sendmail.length;i++)
{
document.sendmail.sendmail[i].selected=false;
}
}
function delall(){
var sendcount;
var optmail;
sendcount=document.sendmail.sendmail.length;
if (sendcount==0)
{
alert("没有可以删除的Email!");
}
for(i=0;i<sendcount;i++)
{
document.sendmail.sendmail.remove(0);
}
}
//-->
</SCRIPT>
<!--#INCLUDE FILE="script/sendnow.inc" -->
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="400" height="70" bgcolor="<%=tablebordercolor%>" border=0 cellspacing=1><tr><td>
<table width="100%" height="100%" border=0 cellspacing=0><tr bgcolor="<%=tablebodycolor1%>"><td>
系统正在处理邮件,请稍候......
</td></tr></table></td></tr></table></div>
<br><br><FORM name=sendmail onsubmit="return sendmail_submit(this);" action=classmaillist.asp
method=post><INPUT type=hidden value=sendmail name=action>
<TABLE cellSpacing=1 cellPadding=3 width=480 align=center border=0 bgcolor=<%=tablebordercolor%>>
<TBODY>
<TR bgcolor=<%=tabletitlecolor%>>
<TD colSpan=2 height=30><IMG SRC="IMAGES/classmail.gif" BORDER=0 ALT=""></TD></TR>
<TR bgcolor=<%=tablebodycolor1%>> <TD colSpan=2 height=20></TD>
</TR>
<TR bgcolor=<%=tablebodycolor2%>>
<TD height=35 align=center>标 题: <INPUT size=25 value="<%=getclassname(clsid)%>"
name=Subject> </TD>
<TD height=35 align=center>回复到: <INPUT size=25
value="<%=htmlencode(rs("email"))%>" disabled><INPUT type=hidden
value="<%=htmlencode(rs("email"))%>" name="from"> </TD></TR>
<TR bgcolor=<%=tablebodycolor1%>>
<td><table border=0 width=210 cellpadding=4 align=center><tr><TD >全部邮件列表:</TD></TR>
<TR >
<TD align=middle width=250><%call classmatelist()%></TD></tr></table></td>
<td><table border=0 width=210 cellpadding=4 align=center><tr><TD >发送邮件列表:</TD></TR>
<TR >
<TD align=middle width=250 ><SELECT
ondblclick="return delmail()" style="WIDTH: 210px; HEIGHT: 100px" multiple
name=sendmail></SELECT></TD></tr></table></td>
</tr>
<TR bgcolor=<%=tabletitlecolor%>>
<TD colSpan=2 height=20 align=right><input type=button value="添加" onclick=javascript:addmail()> <input type=button value="全选" onclick=javascript:selectall()> <input type=button value=删除 onclick=javascript:delmail()> <input type=button value=全删 onclick=javascript:delall()> </TD></TR>
<TR bgcolor=<%=tablebodycolor1%>><td colspan=2>
<table width=90% border=0 align=center cellpadding=4>
<tr> <TD height=20>信件内容:</TD></TR>
<TR >
<TD align=middle><TEXTAREA name=Content rows=8 cols=70></TEXTAREA> </TD></TR></table></td></tr>
<TR bgcolor=<%=tabletitlecolor%>>
<TD colSpan=3 height=20 align=right><input type=submit value=发送邮件 name=submit> </TD></TR>
</TBODY></TABLE></FORM>
<%
set rs=nothing
end sub
function getclassname(classid)
dim tmprs
set tmprs=conn.execute("select classname from class where classid="&clsid)
if not tmprs.eof then
getclassname=tmprs(0)
else
getclassname=""
end if
end function
sub classmatelist()
dim cmrs
set cmrs=conn.execute("select realname,email from [student] where userid in (select userid from joinclass where classid="&clsid&")")
response.write "<SELECT ondblclick='return addmail()' style='WIDTH: 210px; HEIGHT: 100px' multiple name=allmail>"
do until cmrs.eof
response.write "<option value="&cmrs(1)&">"&cmrs(0)&"</option>"
cmrs.movenext
loop
response.write "</select>"
set cmrs=nothing
end sub
sub sendmail()
dim rs,sql
sql = "select studcount from [class] where classid="&clsid
set rs=conn.Execute(sql)
if rs("studcount")=1 then
Errmsg=Errmsg+"<br>"+"<li>操作失败!目前贵班还没有其他成员,你不能只对自己发送邮件。"
founderr=true
else
if request("Subject")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了邮件主题。"
founderr=true
else
mailtopic=request("Subject")
end if
if request("from")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了回复地址。"
founderr=true
elseif not IsValidEmail(request("from")) then
Errmsg=Errmsg+"<br>"+"<li>错误的回复地址。"
founderr=true
else
mailfrom=trim(request("from"))
end if
if request("sendmail")="" then
Errmsg=Errmsg+"<br>"+"<li>您没有选择给谁发信!"
founderr=true
else
mailto=request("sendmail")
end if
if request("Content")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了邮件内容。"
founderr=true
else
mailbody=request("Content")&chr(13)&chr(10)&space(20)&"--------------"
mailbody=mailbody&chr(13)&chr(10)&space(10)&getrealname(membername)
end if
end if
set rs=nothing
if founderr=true then
call error("Information",errmsg)
exit sub
end if
if EmailFlag=0 then
errmsg=errmsg+"<br>"+"<li>本同学录不支持发送邮件。</li>"
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
elseif EmailFlag=1 then
call jmail_smtp()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
elseif EmailFlag=4 then
call jmail_msg()
end if
if SendMailStatus="OK" then
stitle="邮件发送成功"
smsg="您已经成功的向班内所选同学发送了邮件。"
call success(stitle,smsg)
else
errmsg=errmsg+"<br>"+"<li>由于以下原因邮件发送失败!</li>"
errmsg=errmsg+"<br>"&SendMailStatus
call error("Exclamation",errmsg)
end if
end sub
%>
<%call footer%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -