日期:2008-12-13  浏览次数:20790 次

这是整个邮件列表程序服务端,由管理者运行:
文件名mailadmin.ASP:
<%
'使用这段代码时,请将所有的邮件列表(后缀为lst)文件和

'信件文件(后缀为ltr)都放到根目录basedir中,并保证对给目录有写的权限

Dim debug
debug = false

BASEDIR = Server.MapPath("/tmp/maillist")

Forreading = 1
Forwriting = 2
Forappending = 8
'分隔字符
delimiter = "|"

' 本代码的URL注意不是路径
SCRIPT_URL="mailadmin.ASP"

' 代码中使用了CDO NTS来发送邮件
' $DEFAULT_EMAIL是来保存默认的寄信人地址的变量(可根据自己情况进行修改)

DEFAULT_EMAIL="YourName@YourMailServer"


cpr = ""

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) <> 0 and _
    strcomp(Request.ServerVariables("QUERY_STRING"), "", vbtextcompare) = 0 then
    query_form
    Response.End
end if

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) = 0 and _
    Request.Form("action") = "LIST" then
    get_list
    Response.End
end if

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) = 0 and _
    Request.Form("action") = "SENDMAIL" then
    send_mail
    Response.End
end if

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) = 0 and _
    Request.Form("action") = "POSTLETTER" then
    post_letter
    Response.End
end if

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) = 0 and _
    Request.Form("action") = "EDIT" then
    ltr_editor
    Response.End
end if

if strcomp(Request.ServerVariables("REQUEST_METHOD"), "POST", vbtextcompare) = 0 and _
    Request.Form("action") = "PURGE" then
    purge_names
    Response.End
end if

error_report("没有设置正确参数。")


sub    msginfo(str)
    if debug then
        Response.Write str & "<br>" & vbCrlf
    end if
end sub

sub query_form ()

fileselect = get_files("filename","lst")
ltrselect = get_files("lfilename","ltr")

%>

<CENTER>
<TABLE WIDTH=550 CELLPADDING=2 BORDER=1 BGCOLOR="FFFF00">
  <TR>
   <TD ALIGN=CENTER>
     <H2>邮件列表管理界面</H2>
     <TABLE WIDTH=500 BORDER=1 CELLPADDING=5 CELLSPACING=0>
      <TR>
      <TD BGCOLOR="99FF99">
        <BR>
      <FONT FACE="ARIAL">
      欢迎来到邮件列表示例,使用它可以给你的列表用户发送信件。
      <BR> 
 &n