html form guide
  about

cgi form mail example

The form mail script collects the data submitted in a form, (optionally) formats it, and sends it to one or more email addresses. For more information on form mail scripts and a list of free form mail scripts see Some form mail script examples.

This page explains the usage of Perl based, NMS FormMail.

Using the form mail script

This guide takes you step by step through creating a form and getting the form submissions by email.

Step 1: Download the form mail script

Download the script from http://nms-cgi.sourceforge.net/scripts.shtml Download the TFMail package from the page and unzip it.

Step 2: Modify the script

Now you have to modify the script that you had downloaded in step 1. Open the TFMail.pl in a text editor and update the script. Instead of 'johnd' it will be your user name. Depending on your hosting account, the actual path can vary.

Note: Important! do not put the configuration files in a location that could be accessed from the web.

cgi form mail : editing the code

Step 3: Update the configuration file

open the default.trc file (from the downloaded files in step 1) save it as say, feedback.trc

Edit feedback.trc and change recipient to your email address.

cgi form mail : editing config file

Step 4: Upload the files

  • Login to your web server through FTP.
  • Create a folder tfmail in the base folder
  • Note: Important! do not put the configuration files in a location that could be accessed from the web.

  • Upload the following files to the tfmail folder
    • MIME_Lite.pm
    • NMSCharset.pm
    • NMStreq.pm
    • email.trt
    • missing.trt
    • spage.trt
    • feedback.trc
    • (created in step 3)

    cgi form mail : uploading

  • Upload the TFmail.pl to the cgi-bin folder. Update the file permissions of TFmail.pl to 755

Step 5: Create the form

Use an HTML editor to create the form

The code for a sample form is given below:

<form name='feedback' method='POST' action='/cgi-bin/TFmail.pl' accept-charset='UTF-8'>
<input type='hidden' name='_config' value='feedback' />
Name: <br> <input type='text' name='Name' size='20'/><br>
Email: <br> <input type='text' name='Email' size='20'/><br>
Comments: <br>
<textarea name='Comments' cols='50' rows='8'></textarea><br>
<br>
<input type='submit' name='Submit' value='Submit'/>
</form>

Upload the page containing the form also to the web server

Step 6: Test the form!

Open the form page and submit some sample data.

  • Digg
  • del.icio.us
  • Netscape
  • Reddit
  • StumbleUpon
  • Technorati
  • YahooMyWeb


Related pages

 
  • Digg
  • del.icio.us
  • Netscape
  • Reddit
  • StumbleUpon
  • Technorati
  • YahooMyWeb
Email forms
  How to get email from html form submission

Email form using 'mailto'

Form to email using PHP

Email form with file attachment in PHP

Form mail scripts
  Form mail script selection guide

Perl based form mail

Contact Forms
  PHP based email contact form

Secure your HTML contact form using captcha
PHP Form
  PHP form validation script

PHP form tutorial: first steps

PHP form processing

PHP form 'GET'

PHP form 'POST'

Handling checkbox in PHP form processor

Handling select box in a PHP form

Using PHP_SELF in the action field of a form

How to submit a form using PHP

Creating a registration form using PHP

Making a login form using PHP

Creating a multi-page order form using PHP

Passing PHP form variables from one page to other

  Copyright © 2008 html-form-guide.com . All rights reserved.