文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页精文荟萃软件资讯 → 一个免费的邮件列表源程序一

一个免费的邮件列表源程序一

时间:2004/10/7 19:18:00来源:本站整理作者:蓝点我要评论(0)

  MailToList.asp

  <%@ language="JavaScript">

  <%

  // output relevant meta tags

  Init( "Mail to list" );

  // output common top of page

  Header( 'Work --> Mail to list', 3 );

  // output page content

  Content ( );

  // output common bottom of page

  Footer( );

  %>

  <% standard="" page="" elements="">

  <%

  // ============================================

  // the content of this page

  // ============================================

  function Content ( )

  {

  Out ( '' );

  Out ( '' );

  Out ( '' );

  Out ( '' );

  Out ( '

  &nbsp;

  ' );

  // if the form has a password, validate it first

  // so that if it fails we can show the form again

  var bSubmitted = (Request.Form.Count > 0);

  // has the form been submitted?

  if ( bSubmitted )

  {

  // get the password from the form...

  sPassword = "" + Request.Form ( "password" );

  // validate the password and moan if it fails

  if ( sPassword != sDBPath )

  {

  Out ( '

  Invalid password!

  ' );

  // pretend the form hasn'\t been sent yet

  bSubmitted = false;

  }

  }

  // show the form if not submitted yet

  if ( !bSubmitted )

  {

  Out ( 'In Part 1 I showed you how I allowed you to subscribe to my mailing list. Here\'s where I can post an email to members of that mailing list.' );

  Out ( '

  Strangely, I\'m not going to let you do it, but you can 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 answer - in this case

  // it's the  page. the method can be "post" to send the

  // form data 'behind the scenes' or "get" to appending the

  // data to the URL in the style page.asp?data1=a&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 ( '

  ' );

  // another table to line up the titles and inputs

  Out ( '' );              Out ( '

  ' );

  Out ( 'Password:' );

  Out ( '

  ' );

  // a simple text box. we'll reference it with the name "password"

  // and show 37 characters on the form. use the maxlength

  // attribute to set the maximum characters they can enter.

  // use value="some text" to pre-fill the input with data.

  Out ( '' );

  Out ( '

  ' );

  Out ( 'Message:' );

  Out ( '

  ' );

  // textarea is a multiline text box. specify the size with the

  // cols and rows attributes. wrap can be "off" (the default)

  // "physical" or "virtual". as an example, consider the user

  // typing in the following text in a 40 character wide input:

  //

  // "I wonder how this text will appear 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="physical" will physically split 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 input. Perfect!

  Out ( '' );

  Out ( '

  ' );

  Out ( '&nbsp;' );

  Out ( '

  ' );

  // type='submit" provides a submit button to perform the

  // form action. the button says "Submit" unless you override

  // with the value attribute.

  Out ( '' );

  Out ( '

  ' );

  Out ( '' );

  }

  else

  {

  // get the message from the form

  var sMessage = "" + Request.Form ( "message" );

  // open the connection

  DBInitConnection ( );

  // get the emails addresses

  var sSQL = 'SELECT Email FROM MailingList;';

  DBGetRecords ( sSQL );

  var sEmailList = "";

  var sSep = "";

  while ( !oRecordSet.EOF )

  {

  sEmailList += sSep + oRecordSet ( 0 );

  sSep = ";";

  oRecordSet.MoveNext ( );

  }

  // free the connection

  DBReleaseConnection ( );

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

  Out ( '

  Email sent successfully.

  ' );

  }

  Out ( 'Want to see how this form to mail the subscribers was done? Click below to get all the source code!' );

  Out ( '

  ' );

  Out ( '' );

  Out ( '' );

  }

  // ============================================

  // email me!

  // ============================================

  function Email ( sSubject, sEmail, sMessage )

  {

  // send an email to the address just to confirm what just happened

  var oMail = Server.CreateObject ( "CDONTS.NewMail" );

  // setup the mail

  oMail.From = oMail.To = 'MailingList@shawthing.com';

  oMail.Bcc = sEmail;

  oMail.Importance = 1;

  oMail.Subject = sSubject;

  oMail.Body = sMessage;

  // send it

  oMail.Send ( );

  // release object

  oMail = null;

  }

  %>

  utils/Database.asp

  <%

  // globals

  var oConnection;

  var oRecordSet;

  var sConnection;

  // ============================================

  // example usage:

  //      DBInitConnection ( );

  //

  //      var sSQL = "SELECT * FROM Somewhere";

  //

  //      DBGetRecords ( sSQL );

  //

  //      ...use oRecordSet

  //

  //      DBReleaseRecords ( );      // optional step

  //

  //      DBReleaseConnection ( );

  // ============================================

  // ============================================

  // initializes database variables for first use on page

  // ============================================

  function DBInitConnection ( )

  {

  // don't open it again if already opened!

  if ( sConnection != undefined )

  return;

  // get connection object

  oConnection = Server.CreateObject( 'ADODB.Connection' );

  // get the database connection string

  // use MapPath to make relative path into physical path

  sConnection = 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=' + Server.MapPath ( sDBPath );

  // open the connection

  oConnection.Open( sConnection );

  // as an attempt at optimization we now open

  // the recordset here, not in DBGetRecords()

  oRecordSet = Server.CreateObject ( 'ADODB.Recordset' );

  }

  // ============================================

  // tidies up after DBInitConnection

  // ============================================

  function DBReleaseConnection ( )

  {

  // don't release the connection if not connected!

  if ( sConnection == undefined )

  return;

  // as an attempt at optimization we now close

  // the recordset here, not in DBReleaseRecords()

  if ( oRecordSet.State != 0 )

  oRecordSet.Close();

  oRecordSet = undefined;

  oConnection.Close();

  oConnection = undefined;

  sConnection = undefined;

  }

  // ============================================

  // executes the passed in SQL statement

  // and returns the oRecordSet object

  // ============================================

  function DBGetRecords ( sSQL )

  {

  // remember that this can fail if passed garbage, and hence

  // 'oRecordSet' will already be 'closed'

  oRecordSet = oConnection.Execute( sSQL );

  }

  // ============================================

  // tidies up after DBGetRecords

  // ============================================

  function DBReleaseRecords ( )

  {

  // IMPORTANT: THIS FUNCTION INTENTIONALLY BLANK

  // as an attempt at optimization we now open/close

  // the recordset with the connection, not separately

  // so all code was moved to DBReleaseConnection.

  // it is recommended that you still call this function as soon

  // as the recordset is finished with.

  // note that it is assumed by the caller that it is legal

  // to call DBReleaseConnection without calling this function

  }

  %>

  &nbsp;

相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 360快剪辑怎么使用 36金山词霸如何屏幕取词百度收购PPS已敲定!3

最新文章 微信3.6.0测试版更新了微信支付漏洞会造成哪 360快剪辑怎么使用 360快剪辑软件使用方法介酷骑单车是什么 酷骑单车有什么用Apple pay与支付宝有什么区别 Apple pay与贝贝特卖是正品吗 贝贝特卖网可靠吗

人气排行 xp系统停止服务怎么办?xp系统升级win7系统方电脑闹钟怎么设置 win7电脑闹钟怎么设置office2013安装教程图解:手把手教你安装与qq影音闪退怎么办 QQ影音闪退解决方法VeryCD镜像网站逐个数,电驴资料库全集同步推是什么?同步推使用方法介绍QQ2012什么时候出 最新版下载EDiary——一款好用的电子日记本