⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mailadmin.asp

📁 一套简单的ASP邮件列表
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' mailadmin.asp: subscription e-mail collector with subscribe
' and unsubscribe features.
' Release 0.99 on 06/20/99
' (C) 1999 FreeASP.Com, Inc. This program is freeware and may 
' be used at no cost to you (just leave this notice intact). 
' Feel free to modify, hack, and play  with this script. 
' It is provided AS-IS with no warranty of any kind.                
' We also cannot assume responsibility for either any programs      
' provided here, or for any advice that is given since we have no   
' control over what happens after our code or words leave this site.
' Always use prudent judgment in implementing any program- and      
' always make a backup first!
' We also appreciate if you can let us know your site url that use this
' script.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'' SECURITY NOTICE ' SECURITY NOTICE ' SECURITY NOTICE '''''''''''
'
'   This script has NO security features built in. Please 
'   consult the README.TXT file for information on securing
'   this script from abuse.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''' USER CONFIGURATION SECTION ''''''''''''''''''''''''''''''''''
' BASEDIR is the full directory path to where you will store your
' mail list (lst) files and letter (ltr) files. Be certain that
' the script can write to this directory
Dim debug
debug = false

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

Forreading = 1
Forwriting = 2
Forappending = 8
delimiter = "|" ' Pipe is delimiter

' SCRIPT_URL is the URL (not path) of this script.
SCRIPT_URL="mailadmin.asp"

' MailAdmin use CDO NTS to send out mail
' $DEFAULT_EMAIL is used as the default "from" e-mail address
' for your mailings. You can type over this value when sending
' mail.

DEFAULT_EMAIL="newsletter@freeasp.com"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
cpr = ""
setup

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("Called without proper options set")

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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>FreeASP"s MailAdmin </H2>
     <TABLE WIDTH=500 BORDER=1 CELLPADDING=5 CELLSPACING=0>
      <TR>
      <TD BGCOLOR="99FF99">
       &nbsp<BR>
      <FONT FACE="ARIAL">
      Welcome to FreeASP's Maillist Subscription Manager Control
      Panel! The forms below will allow you to manage your
      mailing lists, create and edit your letters, and send
      out mailings.
      <BR>&nbsp
       </FONT>
      </TD>
      </TR>

      <TR>
      <TD>

     <FORM ACTION="<%= SCRIPT_URL %>" METHOD="POST">
     <TABLE WIDTH=500 BGCOLOR="CCCCCC" BORDER=1 CELLPADDING=5 CELLSPACING=0>
      <TR>
       <TD COLSPAN=2 BGCOLOR="CCCCCC">
        <CENTER><FONT SIZE=+1><B>Maintain Mailing Lists</B></FONT></CENTER>
      <FONT SIZE=-1 FACE="ARIAL">
      This form allows you to edit the mailing lists collected
      by your FreeASP Subscription Manager. Please use the selection
      bar to pick the mailing list file you wish to review. 
      You may also enter an e-mail address, or part of one into
      the search box and the script will return all all matching
      records. If you want to select the entire contents of a file,
      just leave the search box empty.
      Click on GO-GET-EM! when ready.
       </FONT>
       </TD>
      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Please select a list file</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
     <%= fileselect %>
      </TD>
     </TR>
      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Partial address to search on</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
       <INPUT TYPE="TEXT" NAME="search" SIZE=30 MAXLENGTH=100 VALUE="">
      </TD>
     </TR>
     <TR>
      <TD BGCOLOR="CCE6FF"><B>Fire when ready</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
        <INPUT TYPE="submit" VALUE="GO GETEM!"> 
        <INPUT NAME="action" TYPE="hidden" VALUE="LIST">
      </TD>
      </TR>
      </TABLE>
     </FORM>

     <FORM ACTION="<%=SCRIPT_URL%>" METHOD="POST">
     <TABLE WIDTH=500 BGCOLOR="CCCCCC" BORDER=1 CELLPADDING=5 CELLSPACING=0>
      <TR>
       <TD COLSPAN=2 BGCOLOR="CCCCCC">
        <CENTER><FONT SIZE=+1><B>Maintain Letters</B></FONT></CENTER>
      <FONT SIZE=-1 FACE="ARIAL">
      To create a new form letter file, select the YES button for
      <I>Create new letter</I>. To edit an existing letter, simply
      pull down on the selector bar and pick the desired letter file.
      Click on DO-IT! when ready.
       </FONT>
       </TD>
      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Please select a letter file</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
     <%= ltrselect %>
      </TD>
     </TR>
     <TR>
      <TD BGCOLOR="CCE6FF"><B>Create a new letter?</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
        <INPUT TYPE="radio" NAME="newfile" VALUE="NO" checked>NO
        <INPUT TYPE="radio" NAME="newfile" VALUE="YES">YES
      </TD>
      </TR>

     <TR>
      <TD BGCOLOR="CCE6FF"><B>Fire when ready</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
        <INPUT TYPE="submit" VALUE="DO IT!"> 
        <INPUT NAME="action" TYPE="hidden" VALUE="EDIT">
      </TD>
      </TR>
      </TABLE>
     </FORM>

     <FORM ACTION="<%=SCRIPT_URL%>" METHOD="POST">
     <TABLE WIDTH=500 BGCOLOR="CCCCCC" BORDER=1 CELLPADDING=5 CELLSPACING=0>
      <TR>
       <TD COLSPAN=2 BGCOLOR="CCCCCC">
        <CENTER><FONT SIZE=+1><B>Send out Mailing</B></FONT></CENTER>
      <FONT SIZE=-1 FACE="ARIAL">
      This form allows you to send out e-mail to your subscribers.
      Use the selector bars to pick your mailing list and form letter
      file. You may also enter a subject line and return e-mail address.
      Of course- <B>be very careful to pick the correct letter and
      list before sending!</B> As the mail is being sent, you will
      see each address and it"s status displayed. In the event the 
      script is interrupted, you will know where it left off.
      Click on MAIL-EM! when ready.
       </FONT>
       </TD>
      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Please select a LIST file</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
     <%= fileselect %>
      </TD>
     </TR>
      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Please select a LETTER file</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
     <%=ltrselect%>
      </TD>
     </TR>

      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>From</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
       <INPUT TYPE="TEXT" NAME="from" SIZE=25 MAXLENGTH=100 VALUE="<%=DEFAULT_EMAIL%>">
      </TD>
     </TR>

      <TR>
      <TD  BGCOLOR="CCE6FF">
        <B>Subject Line</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
       <INPUT TYPE="TEXT" NAME="subject" SIZE=25 MAXLENGTH=100 VALUE="">
      </TD>
     </TR>

     <TR>
      <TD BGCOLOR="CCE6FF"><B>Fire when ready</B>
      </TD>
      <TD BGCOLOR="CCE6FF">
        <INPUT TYPE="submit" VALUE="MAILEM!"> 
        <INPUT NAME="action" TYPE="hidden" VALUE="SENDMAIL">
      </TD>
      </TR>
      </TABLE>
     </FORM>

     </TD>
     </TR>
     </TABLE>
     <%= cpr %>
   </TD>
  </TR>
 </TABLE>
</CENTER>


<% 
end sub

sub send_mail ()
	on error resume next
	Dim i, j, maillist, toList, start, finish, last, total, mailresult
	Dim f, fso, lettext
	
	if Request.Form("filename") = "" or Request.Form("lfilename") = "" then
		error_report("No letter file or mail list file selected")
	end if
	if Request.Form("from") = "" or Request.Form("from") = "" then
		error_report("The from e-mail is missing or invalid")
	end if
		
	lettext=""
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	Set f = fso.OpenTextFile(BASEDIR & "\" & Request.Form("lfilename"), ForReading, false)
	lettext = f.readall
	'Open the maillist
	f.close
	Set f = fso.OpenTextFile(BASEDIR & "\" & Request.Form("filename"), ForReading, false)
	maillist = split(f.readall, vbCrlf, -1, vbtextcompare)
	Set f = nothing
	Set fso = nothing
	on error goto 0
	if not isarray(maillist) then
		exit sub
	end if
	
	last = Ubound(maillist) - 1
	Response.Write "<PRE>Mail being sent ot subscribed members of " & Request.Form("filename") & vbCrlf

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -