Helpdesk


Lonestar Home

Search Lonestar


Webmail

Texas.Net (Business)

Contact Info

Account Info
Change Password
Add Popmail
Spam Filter

Internet Alerts
Virus Alerts
Security Alerts
Hoax Alerts
Spam Email

Helpdesk
General Settings
Windows Setup
Macintosh Setup
Other OS Setup
Internet Software
Email Setup
Usenet News Setup
Web Page Setup
Modem Tips

E-mail Support
Trouble Ticket
Billing Ticket

Software

Parental Controls

Disclaimers
Terms & Conditions
Acceptable Use
Privacy Policy
Legal Text
English Text

Customer Pages

Internet Basics
World-Wide Web
E-mail
USENET News
FTP

Links
Staff Picks
Games
Windows 98
Macintosh
Kids' Links


Adding A Mailed Form

There are times when a one-way broadcast-style web page isn't enough, and you need an easy way for people to send you information, be it comments or questions. This is done with the use of HTML forms. Texas.Net provides a method for form contents to be e-mailed directly to you, removing the need for you to write or purchase CGI programs to do this.

Warning: The following document assumes you have some knowledge of HTML and how HTML forms work. If you do not know what this means, consult your HTML editor documentation or refer to an HTML reference.

Step 1: Creating a form

To add a form to your web page, use the appropriate functions in your HTML editor, or you can do it by hand:

<form action="http://url.to.cgi" method="post">

<input type="text" name="Name" value="Type your name here">
<input type="submit" value="Submit your name!">

</form>

The above HTML code generates a single input field and a submit button right next to it. When you press the submit button, the information in the input field is sent to the CGI application referenced in the action field of your form element, in this case "http://url.to.cgi". The CGI application is then responsible for dealing with the information. To use Texas.Net's mailer CGI, you need to do the following:

Step 2: Pointing your form to Texas.Net's CGI

  • Change the "action" field in your form to point to Texas.Net's CGI script:
    • http://lonestar.texas.net/cgi-bin/mailer.pl
  • Add the following "hidden" fields to your form (as needed):
    • <input type="hidden" name="mail-to" value="email@address">
    • <input type="hidden" name="mail-from" value="email@address">
    • <input type="hidden" name="mail-subject" value="Subject">
    • <input type="hidden" name="mail-success" value="http://url">
    • <input type="hidden" name="mail-fail" value="http://url">
    • <input type="hidden" name="mail-noempty" value="1">
    • <input type="hidden" name="mail-reqfield" value="Field">
    • <input type="hidden" name-"mail-namefield" value="Field">
    • <input type="hidden" name-"mail-nohost" value="1">

    None of these fields are required if you have a traditional lonestar.texas.net or www.texas.net account. If you have one of our larger virtual sites or any other non-standard Texas.Net web page, you should add the "mail-to" input field to ensure form submissions get to you.

    The "mail-empty" field set to a value of "1" will prevent submission of the form unless certain fields are filled in. This field works in conjunction with the "mail-reqfield" fields. If no "mail-reqfield" is present and the "mail-noempty" field is set to "1", all fields will be required. If one or more "mail-reqfield" tags are present, only the particular fields represented by the "mail-reqfield" values will be checked for data. Make sure that values in "mail-reqfield" tags are both spelled correctly (names are case-sensitive) and present in your form or else people will not be able to use your form.

    The "mail-success" and "mail-fail" fields are URLs to web pages that indicate a success or failure message. After the form is submitted, the script will automatically forward the visitor to the URL specified in the "mail-success" field (if any). A default, plain 'Thank you' message will be shown if this field does not exist. The "mail-fail" URL will only be sent if you have the "mail-noempty" field set to something besides 0 and there are empty fields.

    The "mail-namefield" field is an optional one that lets you specify which field you would like to act as the name of the sender ("name" <email@addy.com>). Most forms usually ask for a name of some sort and this allows you to attach that name to an e-mail address that you might request. Please note, this field's value is a name of another field (the one whose value is the name), not the name of the person itself. The "mail-nohost" field is can optionally allow you to remove the listing of the host sending the form from the e-mail that you receive. Texas.Net does not recommend that you use this option as it is your only way of tracking the source of the e-mail, but some people parse the information in the form and the host information can through parsing programs into fits. In the example above, the new form will read:

    <form action="http://lonestar.texas.net/cgi-bin/mailer.pl" method="post">

    <input type="hidden" name="mail-to" value="login@texas.net">
    <input type="hidden" name="mail-from" value="nobody@texas.net">
    <input type="hidden" name="mail-subject" value="Someone's Name">
    <input type="hidden" name="mail-success" value="http://lonestar.texas.net/~login/success.html">
    <input type="hidden" name="mail-namefield" value="Name">

    <input type="text" name="Name" value="Type your name here">
    <input type="submit" value="Submit your name!">

    </form>

    The form above, since it lacks the "mail-noempty" field, will not check to be sure "Name" is filled in. The e-mail it sends will look something like this:

    From: Web Form <nobody@texas.net>
    To: "Type your name here" <login@texas.net>
    Subject: Someone's Name

    Host: ec2-54-90-159-192.compute-1.amazonaws.com
    Name: Type your name here

    -----

    You can view a sample page that makes use of this script. Try looking at the source to see how you can implement the features of the script in various ways. Like the CGI Counters and customer pages themselves, Texas.Net does not offer telephone support for CGI applications such as this. If the script isn't functioning as it should, feel free to drop a line to the Texas.Net Helpdesk but a response is not guaranteed.

©1994-2005, Texas.Net, Inc. All rights reserved.