Creating WebSite Specific Postcards

Creating WebSite Specific Postcards
Postcards, e-cards, and e-messages are extremely popular on the web. Here is how you can code your own site-specific postcards for your website, using ASP.

First, visit the BellaOnline Postcards area to get a sense how our postcards here work. They are fully code in ASP.

At the most basic level, postcard code is a form. You input your own email address, the destination email address, and a message. You also choose an image. All of those things are done with a basic HTML form, no ASP is necessary.

On the processing page, the ASP script takes each of those values into a variable. You use standard ASP commands (found on this site) to first get the maximum postcard ID from a counter table in your database, and to increment it by 1. You write that new number back to the database. Now you are able to construct the postcard's file name, let's say it is

postcard999.html

Now comes what might be deemed the "tricky" part. You need to write out a HTML file called postcard999.html on your webserver for the end user to view. This HTML fiel will "look" like a postcard page, and will be what you tell the recipient to view. It needs to be a fully valid HTML document.

So you open a file, named postcard999.html, with standard ASP file open commands. You then start to write to this file lines such as

<HTML>
<HEAD>
<TITLE>Site Postcard<\title>
</HEAD>
<BODY>

Here is where you write the layout for your postcard page. It really helps if initially you write the very barest of bones - an IMG SRC to show the picture, and then a TO: with the to email, and a FROM with the from email. Start very simple. Once you get that working, you can start to make it more fancy.

Once you close out the file, it is time to send the email message. Use standard ASP commands to send a message "to" the to address, and "from" the from address. The body of the message would say that a postcard has been created, and the full URL of that postcard999.html should be provided.

Once that is done, redirect the user to a thank you page, thanking them for creating a postcard in your system.

That's it! Experiment at first with a single postcard image. Make sure that you can get the to, from and message from the user, and construct the postcard file and send the message. Once you get those basics down, it should be easy to expand the system so the postcards are more pretty, and so that you have more options to work with, including stamps, songs, borders, and more.




RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2023 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.