Article | Topic: ASP Single Page Solutions

Online Portfolio | Search Optimization | Archive
Web Design | Custom Scripting | Web Database | E-Commerce | Search Optimization | Flash Web Design | Consulting
Template 'Tuning' | Template Designs
Desktop Solutions | Database Solutions | Automation Solutions | Integration | Project Solutions
Flash | 3D Design | 3D For The Web | Animation | Graphic Design | Conceptual Design | Reality Modeling
E-Learning | Disc Media | Business Graphics | Marketing Media | Custom Documents
Articles | Price Quotes | Site Map | Search Site | Web Links | About Neo•Paradigms | Contact Us
Anatomy of a Dynamic Web Page

Part 3: Sending Email

Wrapping Up; Pick Your Script
Alright, I know we are talking about ASP but what you might not realize is that you actually have several 'flavors' of ASP to choose from. Most folk know that VBScript is ASP, some may have even heard about JScript (the Microsoft version of JavaScript). Few, however, know that Perl has its place in ASP as well. It is known when used thus as 'PerlScript' and it might be a very good choice to use for this task. Most people - well, most people who have ever put up a webmailer page - have come across a most excellent little freeware Perl file called FormMail. Most web hosts even offer it as a free plug-in. Higher praise is hard to offer. The point is that you are not confined to a single language base and Perl is a valid choice for many tasks. We will stay within the generic ASP pseudo-language for our discussion.

Send Mail

Recall that we are still within our original, single page. We have collected our information, validated it, and added a record to our database. We still have all of our information in Page Memory. All we have to do is assemble it, format it a bit so that it is intelligible to us when we get it (as opposed to a single line of unbroken data), and send it to ourselves.

Since this is a fairly common task, sending email, it might be a good idea to write a function that can be called easily whenever we want it. The pseudo-code for it will look much like this:

SendMail_Function (ToWho, FromWho, Subject, Message)
    Declare variables
    Get valid SMTP object
    Set SMTP object properties (assemble the email message)
    Send Mail.

You would store this function somewhere on your server in a file that you then include in the page that needs to perform this function. You might store a great many useful little functions in a common library (hint, hint).

Returning to our page code, we must assemble the message parts for our function to use. the email addresses for To and From as well as the Subject are no trouble. The message will need to be formatted, however. You will need to write Line Breaks (or Carriage Returns) into the message text. The process will look like this:

    Declare a Message_Variable

    Add a definition string + your form data string + Line Break to Message_Variable
    Repeat until done

Once completed you need to call your function to do the work

                                         "Contact From WebSite",

- At this point I feel it is probably a good idea to add one more piece of extraneous information. Pay attention, however, because it is NOT trivial. If you put your email address into your webpage, even in code sections, it is vulnerable to unintended use by SPAMBOTs. In short, do not use your email address as text without taking some precaution to shield it from illicit use. The simplest mechanism - simple but effective - is to HTML Encode your email address text.

And, completing our page, redirect the user to a new page; Home, Thank You, etc. You have completed a series of tasks all within a single page.

Back To Library

                       About Us | Site Map | Privacy Policy | Contact Us | ©1992 - 2005 Neo•Paradigms