一个使用CDO的邮件列表ASP程序(用户端)

来源:互联网 发布:淘宝客网站域名 编辑:程序博客网 时间:2024/05/02 08:28
这是用户使用的页面和实现的asp
用户页面:subscrib.html
<BODY BGCOLOR="#ffffff">
<CENTER>
<P>
<table WIDTH=125 BORDER=0 CELLSPACING=0>
<tr> 
<td width="100%" valign="top" align="middle" bgcolor="#0066cc" 
height="20"><strong><font color="#ffffff" size="2" face="Verdana, Arial">
<A NAME="NEWSLETTER">
信件</font></strong></A></td>
</tr>
<tr> 
<td valign="top" bgcolor="#99ccff" width="100%" >
<font face="Arial, Helvetica" size="1"><font color="#000000">
<FORM ACTION="subscribe.asp" METHOD="post">
<INPUT TYPE="radio" NAME="action" VALUE="subscribe" checked>订阅邮件<BR>
<INPUT TYPE="radio" NAME="action" VALUE="unsubscribe">取消订阅<BR>
<CENTER>
<INPUT NAME="email" VALUE="your-email" SIZE=10 MAXLENGTH=100 ><BR>
<INPUT TYPE="hidden" NAME="datafile" VALUE="subscribe">
<INPUT TYPE="submit" VALUE="DO IT!"><BR>
快来加入邮件列表。 
</CENTER></FORM>
</font>
</font>
</td>
</tr>
</table>
</BODY></HTML>
文件名为subscrib.asp
<%
BASEDIR= Server.MapPath("/tmp/maillist")

Forreading = 1
Forwriting = 2
Forappending = 8

delimiter = "|" 
linedelimiter = vbCrlf

valid_page

return_to = Request.ServerVariables("HTTP_REFERER")
the_date = date()
ip_addr = Request.ServerVariables("REMOTE_ADDR")
datafile = Request.Form("datafile") & ".lst"
email = Request.Form("email")
action = Request.Form("action")

if datafile = "" then
Response.Write "配置出错: 没有选择数据文件<br>"
Response.End
end if

if action = "" then
Response.Write "配置出错<br>"
Response.End
end if

if not mailpattern(email) then
bad_email
end if

write_data

thank_you

%>

<%

sub thank_you ()
if action = "unsubscribe" then
whichaction = "移走"
else
whichaction = "添加到"
end if
%>

<CENTER>
<P>
<P>
<TABLE WIDTH="510" BORDER="1" CELLPADDING="3" BGCOLOR="'0066cc">
<TR>
<TD>
<TABLE WIDTH="500" BORDER="1" CELLPADDING="5" BGCOLOR="'99CCFF">
<TR>
<TD>
<CENTER>
<FONT FACE="ARIAL">

<P>
<H1>谢谢 -)</H1>

0 0