Creating a Mailing List ProgramBy Hunter Powers
Have you ever wanted to create a mailing list on your site? Tired of using those so-called free services that insert advertisements into all of your e-mails? Well this is your lucky day. I have written a basic tutorial on how to accomplish this task. Included with this article is all source code free to download.
Part I - Database Design
This is pretty simple. First we create an Access database List.mdb. Then
we create a table,
EmailList with two fields:
ID will be used as our primary key and
Part II - An Insertion Script
Now that we have a database the second part is to create a database insertion scrip to insert e-mail address into the database. The first part in creating the insertion script is to create a generic database include script,
Datastore.inc. This script is responsible for simply establishing a connection
with the database.
Now that we have a database include script we can create our database insertion script,
AddUser.asp. Note that an the file
ADOVBS.INC is included.
For all of you who don't know,
ADOVBS.INC is a file that declares
various functions and variables to help deal with ActiveX Data Objects (ADO). It is
included with the source. There is also a good article on 4Guys about the issue:
ADOVBS.INC - Use It!
Now that we have a database insertion script we can create a simple page to post to our email addresses
Default.asp will use a Form into which the email address
can be entered. When the Form is submitted,
AddUser.asp is called, adding the email address
to the database.
Part III - A Web Based Admin
Okay, so now lets take a look at what we have created. We have created a database to hold our e-mail addresses (List.mdb), a generic database include script (
DataStore.inc), a script to add email addresses to
the database (
AddUser.asp), and a page to post e-mail address to AddUser.asp
The next part in the creation of our Mailing List Program is to create administration pages. Some people like to do things manually but I like nice, easy to use, web based admin pages. For the purpose of this tutorial we will not worry about making everything attractive to the eye, but focus on making everything work. There are three main functions that we want our admin pages to handle:
- List the current users
- Delete users, and
- (Most importantly) E-mail our users
Now, before we continue our journey to create a Mailing List Program I will speak to you about security.
I have placed all of the administrative files into an
/admin folder off of the root. In order to secure
this program you need to either restrict access to this folder from the
IUSR Account (if you don't know
what this is your ISP will), or edit the
security.inc file with your desired security parameters.