亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

一個免費的郵件列表源程序(一)

2019-11-18 22:27:37
字體:
來源:轉載
供稿:網友
MailToList.asp
<%@ Language=javaScript %>

<!--#include file = "include/SetGlobals.asp"-->
<!--#include file = "include/DBPath.asp"-->

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

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

// output page content
Content ( );

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

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

<%
// ============================================
// the content of this page
// ============================================
function Content ( )
{
   Out ( '<td width="20%">&nbsp;</td>' );
   Out ( '<td width="60%">' );
    
      // 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 ( '<h3><font color="red">Invalid password!</font></h3>' );
            // PRetend the form hasn'/t been sent yet
            bSubmitted = false;
         }
      }

      // show the form if not submitted yet
      if ( !bSubmitted )
      {
         Out ( 'In <a href="Subscribe.asp">Part 1</a> 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 ( '<p>Strangely, I/'m not going to let you do it, but you <i>can</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 answer - in this case
         // it's the same 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 ( '<form action="MailToList.asp" method="post">' );
    
            // another table to line up the titles and inputs
            Out ( '<table border="0" cellpadding="0">' );
            Out ( '<tr><td align="right" valign="top">' );
               Out ( 'Password:' );
            Out ( '</td><td align="left" valign="top">' );
               // 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 ( '<input type="password" name="password" size="30"></input>' );
            Out ( '</td></tr>' );

            Out ( '<tr><td align="right" valign="top">' );
               Out ( 'Message:' );
            Out ( '</td><td align="left" valign="top">' );
               // 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 ( '<textarea name="message" cols="30" rows="8" wrap="physical"></textarea>' );
            Out ( '</td></tr>' );

            Out ( '<tr><td align="right" valign="top">' );
               Out ( '&nbsp;' );
            Out ( '</td><td align="left" valign="top">' );
               // type='submit" provides a submit button to perform the
               // form action. the button says "Submit" unless you override
               // with the value attribute.
               Out ( '<input type="submit" value="Send Mail"></input>' );
            Out ( '</td></tr>' );

            Out ( '</table>' );

         Out ( '</form>' );
      }
      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 ( '<p>Email sent successfully.<p>' );
      }

      Out ( 'Want to see how this form to mail the subscribers was done? Click below to get all the source code!' );
      Out ( '<p><center><a href="ShowSource.asp? page=MailToList"><img src="images/source.gif" border=0></a></center>' );

   Out ( '</td>' );
   Out ( '<td width="20%">&nbsp;</td>' );
}

// ============================================
// 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
}
%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
中文字幕欧美视频在线| 久久久久久免费精品| 91系列在线观看| 伊人久久免费视频| 国产精品一区二区在线| 欧美一区二三区| 亚洲成人网久久久| 欧美夫妻性视频| 国产精品日韩一区| 精品久久国产精品| 欧美精品www在线观看| 亚洲黄页视频免费观看| 91久久久在线| 亚洲欧美成人一区二区在线电影| 正在播放国产一区| 成人情趣片在线观看免费| 国产香蕉精品视频一区二区三区| 国产精品专区h在线观看| 国产日韩中文字幕| 欧美亚洲另类在线| 亚洲欧美制服第一页| 国产精品91久久久| 欧美精品电影免费在线观看| 91国偷自产一区二区三区的观看方式| 91九色国产社区在线观看| 国产美女扒开尿口久久久| 中文字幕亚洲精品| 久久99视频免费| 91在线免费视频| 菠萝蜜影院一区二区免费| 亚洲精品国产suv| 欧美精品一本久久男人的天堂| 亚洲天堂视频在线观看| 九九热精品在线| 成人在线小视频| 中文字幕一区二区精品| 538国产精品视频一区二区| 国产精品久久激情| 欧美日韩中文字幕在线视频| 成人免费看黄网站| 欧美大片在线看| 亚洲福利视频久久| 国内精品久久久久| 91精品国产高清久久久久久久久| 亚洲色图偷窥自拍| 久久九九精品99国产精品| 亚洲伦理中文字幕| 久久影视免费观看| 欧美在线一级va免费观看| 精品久久久久久久久久久久久| 成人黄色生活片| 96精品视频在线| 国产精品久久国产精品99gif| 久久精视频免费在线久久完整在线看| 91精品在线播放| 77777少妇光屁股久久一区| 久久久91精品国产一区不卡| 日韩精品在线观看网站| 亚洲爱爱爱爱爱| 欧美日韩成人在线视频| 精品欧美一区二区三区| 欧美日韩国产精品一区二区不卡中文| 动漫精品一区二区| 色综合天天狠天天透天天伊人| 精品亚洲一区二区三区在线观看| 国产精品视频一区二区三区四| 亚洲综合精品一区二区| 国产精品99久久久久久白浆小说| 久久精品中文字幕免费mv| 亚洲天堂影视av| 亚洲伦理中文字幕| 高清一区二区三区四区五区| 国产精品久久久久久av| 日韩在线一区二区三区免费视频| 亚洲天堂精品在线| 欧美精品免费在线观看| 91久热免费在线视频| 国产精品一区二区av影院萌芽| 庆余年2免费日韩剧观看大牛| 热草久综合在线| 国产精品女人久久久久久| 2019中文字幕在线免费观看| 亚洲国产三级网| 2018中文字幕一区二区三区| 黑人欧美xxxx| 久久色免费在线视频| 精品国产一区二区三区久久久狼| 国产99视频在线观看| 日韩国产精品亚洲а∨天堂免| 亚洲精品国产精品久久清纯直播| 狠狠躁夜夜躁久久躁别揉| 国产亚洲激情在线| 国产精品h片在线播放| 日韩中文字幕精品| 亚洲伊人一本大道中文字幕| 色播久久人人爽人人爽人人片视av| 国产精品一区二区三区成人| 久久久久久久国产精品视频| 亚洲一区二区福利| 欧美国产视频日韩| 久久99青青精品免费观看| 国产精品18久久久久久麻辣| 精品国产一区二区三区久久久狼| 色先锋资源久久综合5566| 97精品久久久| 国产精品一区二区久久精品| 欧美性videos高清精品| 国产精品草莓在线免费观看| 欧美精品www在线观看| 久久久久久久香蕉网| 97色伦亚洲国产| 国产视频观看一区| 亚洲一二三在线| 裸体女人亚洲精品一区| 欧美福利在线观看| 亚洲欧美中文另类| 在线观看不卡av| 国产精品久久久久久搜索| 日韩欧美在线看| 亚洲第一精品夜夜躁人人躁| 亚洲精品欧美一区二区三区| 亚洲色图美腿丝袜| 亚洲电影在线看| 久久艳片www.17c.com| 国产精品久久久久久久久久新婚| 亚洲日本成人网| 久久久久女教师免费一区| 日韩av大片在线| 欧美日韩xxxxx| 在线看国产精品| 日韩欧美国产高清91| 亚洲精品二三区| 亚洲综合最新在线| 日韩精品极品在线观看播放免费视频| 国产精品嫩草影院久久久| 久久免费国产精品1| 自拍偷拍亚洲精品| 国产午夜精品免费一区二区三区| 欧美精品videofree1080p| 成人黄色在线观看| 国产精品久久久久9999| 亚洲欧美中文日韩在线| 在线色欧美三级视频| 国产主播喷水一区二区| 欧美国产一区二区三区| 91社影院在线观看| 亚洲国产欧美一区二区三区同亚洲| 欧美xxxx14xxxxx性爽| 国产精品白嫩美女在线观看| 日韩精品在线视频美女| 亚洲欧美在线播放| 亚洲日韩第一页| 国产精品久久久久久久久借妻| 亚洲欧美日韩国产精品| 国产精品美女无圣光视频| 伊人久久五月天| 91在线视频成人| 国产美女直播视频一区| 亚洲精品456在线播放狼人| 精品视频在线播放色网色视频| 亚洲成人性视频| 国产成人亚洲综合91| 少妇高潮久久77777| 久久精品国产亚洲一区二区|