free hosting   image hosting   hosting reseller   online album   e-shop   famous people 
Free Website Templates
Free Installer

Custom E-mail Form


This script allows you to create a simple email form for your site.

It allows formats the output and places it in easy-to-understand fashion in the body of the email.


Paste all of the code below into the head section of your page:
Now paste this code in the body of your page:

How It Works


The form called dataForm contains all the user input data.

Another form, called mailForm , uses the post method to mail the form to the desired email address.

The encoding type is text/plain for universal readability.

HTML encoding could be used, but certain email clients won't recognise this.

Each input box has its own name - recipient, subject, name, country, email, comments.

These parameters are passed to the script when the form is submitted.

The function mailIt() does the formatting.

This is called when the submit button - Send My Email Now - is clicked.

The contents of the form are assigned to the variable data.

The ACTION statement is supplemented by the additional subject and recipient information by the form.action lines.

This merely fills in the recipient and subject panels in the email client.

The remaining user inputs are assigned to the variable userInfo, which then appear in the body section of the email.

Two additional items are also included in the body section:
  • the title of the referring page
  • the URL of that page
  • The above details are then formatted with line breaks ( \n ) and headings to create a legible, understandable output.


    Try It Out

    Send an email to yourself to see how the formatting looks.


    Recipient:
    Subject:
    Your Name:
    Country:
    Email:
    Comments:






    © 2001 CyberSchool