ENoor.com ENoor.com :: Customer Service :: Help :: Forms Image of patch cables

Law Enforcement
Appl. Development
Web Hosting
Email Hosting
Customer Service
Contact Us
About Us
Our Team
Our Clients
Case Studies
How do I have the contents of an online form emailed to me?
Step 1: Construct the ACTION
Use the appropriate ACTION in your HTML. Make sure the FORM tag looks like:
<FORM ACTION="/sharecgi/mail.cgi" METHOD="POST">
Step 2: Decide on an identifier
Decide on a simple identifier for the form. This identifier should be one word with no spaces. Good identifiers would be words like signup or mailinglist. The identifier can only contain the letters a-z,A-Z and 0-9.
Step 3: Add the hidden field to your form
In your form, specify a hidden field named 'template', and set its value to the identifier you chose in step 2. The template is used to specify the confirmation page, and to design the format of the email. For example, if you chose the identifer myForm in step 2, the HTML you would need would look like this:
<input type="hidden" name="template" value="myForm">
Step 4: Create the HTML template
Develop the HTML file that you would like to be displayed after the user hits the 'Submit' button. Store this file in the wizform subdirectory of your HTML root directory. The name of this file should be blah.html, where blah is the identifier you chose in step 2. For example, if you chose the identifier myform, the HTML file name would be myForm.html. If your HTML root directory does not have a subdirectory named wizform, then create that directory using your FTP program, and then store the file there.
Step 5: Create the mail template file
The mail template file is the file that will be used to format the email message that's sent out. The file will be named blah.txt where blah is identifier you chose in step 2. For example, if you chose the identifier myform, the mail template file name would be myForm.txt.
The mail template file can contain any number of d strings that look like -=this=-. Whatever is between the -= and the =- will be replaced by the value of the form field whose name is between the -= and the =-. For example, if there is a form field named 'firstname', as in, say, <input name="firstname">, then if there is the string "-=firstname=-" in the mail template file, that string will be replaced by whatever the user typed in the field named firstname.
The mail template file must include the mail header and the body of the email. The official description of the mail format can be found here, but for our purposes, the following rules are usually sufficient:
  • A mail message is composed of a header and body.
  • The header and body are separated by a blank line.
  • The header must contain one or more lines of the the type: 'Name: Value' where 'Name' is the name of the header, and 'Value' is the value of the header. Note the ':' and single space between 'Name' and 'Value'.
  • Each header name and value pair should be on a single line.
  • The following headers must be present: "From", "Return-Path", "Subject" and "To".
The following example shows a simple "Contact Us" page, and the associated HTML and template files.
<html><head></head><body> <form method=POST action="/sharecgi/mail.cgi"> <input type=hidden name=template value="contact"> <table border=0 cellpadding=0 cellspacing=0> <tr> <td bgcolor="#cccccc"> <table border=0 cellpadding=2 cellspacing=1> <tr> <td bgcolor=white> <input name='yourname' size=30><br>Your Name </td> <td bgcolor=white> <input name='youremail' size=30><br>Your Email </td> </tr> <tr> <td colspan=2 bgcolor=white> <input name='subject' size=64><br>Subject </td> </tr> <tr> <td colspan=2 bgcolor=white> <textarea name=message rows=8 cols=64></textarea><br>Your Message </td> </tr> </table> </td> </tr> <tr><td>&nbsp;</td></tr> <tr> <td align=right> <input type=submit name=submit value='Send Message'> </td> </tr> </table> </form> </body></html>

contact.html HTML template file
<html> <head></head> <body> Thanks! </body></html>

contact.txt Mail template file
From: "-=yourname=-" <-=youremail=-> Return-Path: "-=yourname=-" <-=youremail=-> To: mailFromWeb@example.com Subject: New Email from Website NEW EMAIL FROM WEB SITE ======================= Name: -=yourname=- Email: -=youremail=- Subject: -=subject=- -=message=-
As you may have realized, it's possible to fake email addresses using invalid From: headers. Not only is that not nice, it may violate our Acceptable Use Policy. Please be aware that we will log all emails so that if any threatening, illegal or inappropriate mails are sent out using this system, we can cooperate with the authorities by providing them log file.


© 2002, ENoor Creations, Inc.
825 E. Roosevelt Rd. #118 | Lombard, IL 60148 | 866-ENOOR-COM | info@enoor.com | HTML 4.0