Writing the Code to Send a Message

In this task, you'll create a page that sends an email message to your email address. The content of the message will be hard-coded initially. That is, if you send yourself 20 messages, they'll all have the same subject and body content. Once you have verified that it works, you can build a front-end form for it and change the hard-coded values to dynamic form values.

  1. Open generic_template.asp, choose File > Save As, and name the new file messageSent.asp.

    This new file will do the work of generating and sending the email message and will inform the user that the message has been sent.

  2. Replace the placeholder title with Message Sent. Replace the placeholder body text with Your message has been sent. You should hear from us within two days. Insert a new paragraph with the text, Return to Newland Home, and link the word Home to index.asp.

    You can see the payoff for having created the template already. The new page literally takes seconds to create and customize, as it will appear to the user.

    graphics/06fig07.gif

    What's lacking at this point is the functionality that will generate and send the email. Before dealing with this issue, let's pause for a moment to discuss objects. Many modern computer languagesincluding most languages used for Web programmingcontain them, so it's a good concept to master.