设为首页】 【加入收藏】 【网站地图】 【商品折扣
娱乐一生 娱乐明星
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
首页  |  java  |  .NET  |  C/C++  |  网页技术  |  php  |  asp  |  delphi  |  VC  |  VB开发  |  游戏开发  |  软件工程  |  Power Builder  |  Linux开发  |  Windows开发技巧
当前位置:首页 >> ASP实例 >> 一个免费的邮件列表源程序(一)_ASP实例_src119.com

一个免费的邮件列表源程序(一)_ASP实例_src119.com -

MailToList.a 
<%@ Language=JavaScript %>

<!--#include file = "include/SetGlobals.a quot;-->
<!--#include file = "include/D ath.a quot;-->

<%
// output relevant meta tags
Init( "Mail to list" );

// output common top of page
Header( '<a href="work.a quot gt;Work</a> --> Mail to list', 3 );

// output page content
Content ( );

// output common bottom of page
Footer( );
%>

<% /* standard page elements */ %>
<!--#include file = "utils/Init.a quot;-->
<!--#include file = "utils/Database.a quot;-->
<!--#include file = "utils/Header.a quot;-->
<!--#include file = "utils/Footer.a quot;-->

<%
// ============================================
// the content of this page
// ============================================
function Content ( )
{
 Out ( '<td width="20%" gt am lt;/td>' );
 Out ( '<td width="60%" gt;' );
 
 // if the form has a pa word, validate it first
 // so that if it fails we can show the form again
 var  ubmitted = (Request.Form.Count > 0);

 // has the form been submitted?
 if (  ubmitted )
 {
 // get the pa word from the form...
 a word = " quot; + Request.Form ( " a word" );

 // validate the pa word and moan if it fails
 if (  a word != sD ath )
 {
 Out ( '<h3> lt;font color="red" gt;Invalid pa word!</font> lt;/h3>' );
 // pretend the form ha '\t been sent yet
 ubmitted = false;
 }
 }

 // show the form if not submitted yet
 if ( ! ubmitted )
 {
 Out ( 'In <a href=" u cribe.a quot gt art 1</a> I showed you how I allowed you to su cribe to my mailing list. Here\'s where I can post an email to members of that mailing list.' );
 Out ( '< gt trangely, I\'m not going to let you do it, but you <i>ca lt;/i> get the source code from the bottom of the page, and learn how I did it.' );
 // here's the form tag. the action attribute is the name of
 // the file that will be called with the a wer - in this case
 // it's the same page. the method can be " ost" to send the
 // form data 'behind the scenes' or "get" to a ending the
 // data to the URL in the style page.a ?data1=a&am data2=b
 //
 // use post most of the time - it's neater and "get" is limited
 // in the amount of data that can be sent.
 Out ( '<form action="MailToList.a quot; method=" ost" gt;' );
 
 // another table to line up the titles and i uts
 Out ( '<table border="0" cellpadding="0" gt;' );
 Out ( '<tr> lt;td align="right" valign="to quot gt;' );
 Out ( 'Pa word:' );
 Out ( '</td> lt;td align="left" valign="to quot gt;' );
 // a simple text box. we'll reference it with the name " a word"
 // and show 37 characters on the form. use the maxlength
 // attribute to set the maximum characters they can enter.
 // use value=" ome text" to pre-fill the i ut with data.
 Out ( '<i ut type=" a word" name=" a word" size="30" gt lt;/i ut>' );
 Out ( '</td> lt;/tr>' );

 Out ( '<tr> lt;td align="right" valign="to quot gt;' );
 Out ( 'Me age:' );
 Out ( '</td> lt;td align="left" valign="to quot gt;' );
 // textarea is a multiline text box.  ecify the size with the
 // cols and rows attributes. wrap can be "off" (the default)
 // " hysical" or "virtual". as an example, co ider the user
 // typing in the following text in a 40 character wide i ut:
 //
 // "I wonder how this text will a ear to the server when I send it?"
 //
 // wrap="off" will send it as typed, but the user has to scroll off
 // to the right to see the text. (Horrid)
 //
 // wrap=" hysical" will physically  lit the line after the word
 // 'server' and send two lines to the server
 //
 // wrap="virtual" will send one line, as typed, but the user
 // will see the text nicely wrap in the i ut. Perfect!
 Out ( '<textarea name="me age" cols="30" rows="8" wrap=" hysical" gt lt;/textarea>' );
 Out ( '</td> lt;/tr>' );

 Out ( '<tr> lt;td align="right" valign="to quot gt;' );
 Out ( '&am ' );
 Out ( '</td> lt;td align="left" valign="to quot gt;' );
 // type='submit" provides a submit button to perform the
 // form action. the button says " ubmit" unle  you override
 // with the value attribute.
 Out ( '<i ut type=" ubmit" value=" end Mail" gt lt;/i ut>' );
 Out ( '</td> lt;/tr>' );

 Out ( '</table>' );

 Out ( '</form>' );
 }
 else
 {
 // get the me age from the form
 var sMe age = " quot; + Request.Form ( "me age" );

 // open the co ection
 DBInitCo ection ( );

 // get the emails addre es
 var  QL = 'SELECT Email FROM MailingList;';

 DBGetRecords (  QL );

 var sEmailList = " quot 
 var  ep = " quot 

 while ( !oRecordSet.EOF )
 {
 EmailList +=  ep + oRecordSet ( 0 );

 ep = " quot 

 oRecordSet.MoveNext ( );
 }

 // free the co ection
 DBReleaseCo ection ( );

 Email ( 'It\'s a ShawThing - what\'s new?', sEmailList, sMe age );

 Out ( '< gt;Email sent succe fully.< gt;' );
 }

 Out ( 'Want to see how this form to mail the su cribers was done? Click below to get all the source code!' );
 Out ( '< gt lt;center> lt;a href=" howSource.a ? page=MailToList" gt lt;img src=http://www.knowsky.com/"images/source.gif" border=0> lt;/a> lt;/center>' );

 Out ( '</td>' );
 Out ( '<td width="20%" gt am lt;/td>' );
}

// ============================================
// email me!
// ============================================
function Email (  ubject, sEmail, sMe age )
{
 // send an email to the addre  just to confirm what just ha ened
 var oMail = Server.CreateObject ( "CDONTS.NewMail" );

 // setup the mail
 oMail.From = oMail.To = 'MailingList@shawthing.com';

 oMail.Bcc = sEmail;
 oMail.Importance = 1;

 oMail.Subject =  ubject;
 oMail.Body = sMe age;

 // send it
 oMail.Send ( );

 // release object
 oMail = null;
}
%>
 
utils/Database.a 
<%
// globals
var oCo ectio 
var oRecordSet;
var sCo ectio 

// ============================================
// example usage:
// DBInitCo ection ( );
//
// var  QL = " ELECT * FROM Somewhere" 
//
// DBGetRecords (  QL );
//
// ...use oRecordSet
//
// DBReleaseRecords ( ) // optional step
//
// DBReleaseCo ection ( );
// ============================================

// ============================================
// initializes database variables for first use on page
// ============================================
function DBInitCo ection ( )
{
 // don't open it again if already opened!
 if ( sCo ection != undefined )
 retur 
 
 // get co ection object
 oCo ection = Server.CreateObject( 'ADODB.Co ection' );

 // get the database co ection string
 // use Ma ath to make relative path into physical path
 Co ection = 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=' + Server.Ma ath ( sD ath );

 // open the co ection
 oCo ection.Open( sCo ection );

 // as an attempt at optimization we now open
 // the recordset here, not in DBGetRecords()
 oRecordSet = Server.CreateObject ( 'ADODB.Recordset' );
}

// ============================================
// tidies up after DBInitCo ection
// ============================================
function DBReleaseCo ection ( )
{
 // don't release the co ection if not co ected!
 if ( sCo ection == undefined )
 retur 
 
 // as an attempt at optimization we now close
 // the recordset here, not in DBReleaseRecords()
 if ( oRecordSet.State != 0 )
 oRecordSet.Close();
 oRecordSet = undefined;

 oCo ection.Close();
 oCo ection = undefined;
 
 Co ection = undefined;
}

// ============================================
// executes the pa ed in SQL statement
// and retur  the oRecordSet object
// ============================================
function DBGetRecords (  QL )
{
 // remember that this can fail if pa ed garbage, and hence
 // 'oRecordSet' will already be 'closed'
 oRecordSet = oCo ection.Execute(  QL );
}

// ============================================
// tidies up after DBGetRecords
// ============================================
function DBReleaseRecords ( )
{
 // IMPORTANT: THIS FUNCTION INTENTIONALLY BLANK
 // as an attempt at optimization we now open/close
 // the recordset with the co ection, not separately
 // so all code was moved to DBReleaseCo ection.
 
 // it is recommended that you still call this function as soon
 // as the recordset is finished with.
 
 // note that it is a umed by the caller that it is legal
 // to call DBReleaseCo ection without calling this function
}
%>



 

娱乐图摘

更多 >>

靓丽清纯美女meimei

美女私房全裸照
导演劝女演员脱衣服(视频)

大胆火辣人体艺术写真(图)

黑丝妹妹热辣诱惑-丝袜美女妹妹

PLMM 漂亮妹妹图集-妹妹图库

全球美女图库-美女集中营

52MM 我爱漂亮妹妹-制服妹妹诱惑

图王图库-世界美女明星图片资料库
美女写真集锦

激情两性-解密性生活
浴室MM湿身内衣诱惑
邻家小妹洗澡被偷拍(视频)

热点文章

更多

· XMLHTTP+Javascript+Asp写得聊天室,无刷
· 让您的主页支持各种浏览设备(ASP+篇)(下)_ASP实例_
· 将你的网站设置为客户的信任站点--WSH方案_ASP实例_s
· W3 Jmail中文使用说明_ASP实例_src119.co
· 利用XSL和ASP在线编辑XML文档_ASP实例_src11
· 一种在线人数统计方法(只用1个APPLICATION)_AS
· aspemail组件的应用_ASP实例_src119.com
· ASP连接执行程序 _ASP实例_src119.c
· 嵌入式Web视频点播系统实现方法_ASP实例_src119.
· 利用ASP实现三个强大功能之三_ASP实例_src119.c

热点文章

更多