Toronto Free-Net
  Front  •  Account  •  TFNews  •  Help  •  Contact  
Mailform utility
The Mailform utility provides a mechanism for processing a member-defined HTML form submission, converting it to an easily readable format of Field Names and Contents, and mailing it to the owner of the form web page (or optionally a different mail address specified by a parameter on that web page).

Using the Mailform utilitiy is simple. You need to create TWO web pages:

The first page contains the form, which may be created in any way or shape that you desire, as long as you use METHOD="GET" in your <FORM>. And keep in mind that ALL form fields will be mailed to you, and that the names you use for the 'NAME' attribute in your <INPUT> fields will be the Field Names that appear in the left column of your e-mail. This page should have it's <FORM ACTION=...> point to your second page (your Thank You message).

The second page does the work of mailing the form to you by including in its HTML a Server Side Include command to execute the Mailform utility. The Utility sends the mail, then generates a simple text message thanking your visitor for submitting their information, and displays the submitted information in the same format you will see in your e-mail. Because it is an "Include", you can format the surrounding Thank You page to match the look of the rest of your website, with headers or footers as you desire.

Just add the following line of HTML code to the second web page in the location where you would like the "Thank You" text to appear:

<!--#include virtual="/cgi-bin/tfnmailform" -->

Then change the permissions on the web page containing this command so that the OWNER 'execute' flag is enabled/turned-on. This enables the processing of this SSI code.

When a visitor enters a form, and clicks on submit, they will see your second web page with the following text appearing at the location in your page where you placed the 'include' command listed above:

    Thank you for your submission.

    The following information was submitted:

    Field-Name     Field contents
    Field-Name     Field contents.....

Additional Features/Options:

By using a few simple 'set' commands, you can control the appearance of the 'Thank You' text displayed to the user and choose different options for the e-mail which is sent to you.

E-Mail Recipient
The E-mail message generated is normally sent to the *owner* of the web page, which is the user-id that created the page. In some cases, where multiple user-id's have access to the same web space, the owner may not be the person who you want to receive the e-mail. In this case, you can tell the Mailform utility to send the e-mail to a different address. Just add the following line to the HTML code BEFORE the 'include' command:

<!--#set var="MAILTO" value="emailaddress" -->

Note that the word 'MAILTO' is all upper-case. Mail will always appear to come *from* the owner of the web page. If the E-Mail address is invalid, or cannot otherwise accept mail, the page owner will receive the mail instead. So it is strongly advised that pages with mailto forms are *not* owned by 'unused' accounts.

E-Mail Subject
Normally mail from your form arrives with the Subject heading "Form Data". If you use mutliple forms with different purposes, you may specify different subject headings so that you can distinguish them in your incoming mailbox. To specify a custom Subject heading, add the following line to the HTML code BEFORE the 'include' command:

<!--#set var="SUBJECT" value="Your Subject Here" -->

(Note that the word 'SUBJECT' is all upper-case).

E-Mail Format - No Field Names
It may suit your purposes to have the form field contents mailed to you without the Field Names beside them. You can omit the names by adding the following line to the HTML code BEFORE the 'include' command:

<!--#set var="FORMAT" value="NONAMES" -->

(Note that the words 'FORMAT' and 'NOMAMES' are all upper-case).

Custom Thank You Text
You can change the first line of text that the program generates (the 'Thank you for your submission') by adding the the following line to the HTML code BEFORE the 'include' command:

<!--#set var="THANKS" value="Your text Here" -->

(Note that the 'THANKS' is all upper-case).

Suppressing the Echoing of Submitted Information
If you wish to keep your Thank You Web Page short, you can optionally prevent the listing of submitted information from being echoed back to the person who just submitted it. Just add this set command to your HTML code BEFORE the 'include' command:

<!--#set var="FORMAT" value="NOECHO" -->

(Note that the words 'FORMAT' and 'NOECHO' are all upper-case). 'NOECHO' will not affect the format of your e-mail. If you want to specify both 'NOECHO' and 'NONAMES' put them both in the same 'set' command, like this:

<!--#set var="FORMAT" value="NOECHO,NONAMES" -->

Changing Owner File Permissions to Execute
Sharp-eyed individuals will notice that the 'commands' for the Mailform utility are all enclosed in HTML comments, much the same as Javascript. Unlike Javascript, these commands are not executed by the browser, but instead they are executed by the HWCTFN Server before the page is sent to the browser. If you view the source for a "Thank You" page that has used the TFN Mailform utility, you won't see the commands listed above, you will see the "Thank You" text and HTML code generated by those commands.

In order to execute these kinds of commands (called Server-Side Includes), we need to set the file's 'owner execution' permission flag, so that the server will know to look for these commands hidden in the HTML comments. Note: TFN Information Providers (ip###) do NOT need to do this.

In Lynx (text/telnet sessions), changing file permissions is done on your "g files" display of your public_html directory. Highlight the name of the Thank You page to which you are adding the Mailform command, press "m" (modify), then "p" (permissions). This will display a screen of checkboxes showing the current permissions for your web page. Move the cursor/highlight down to the 'Execute' box under 'Owner' and press right-arrow or Enter to put an "X" in the box ([X]). Then move the cursor down to the 'Submit Form' link at the bottom and press Enter to apply the changes to your page.

In Graphical browsers, you can click on the 'Telnet to TFN' link and follow the instructions above, or you can use the 'CHMOD' option in your FTP program. In WS-FTP_LE, you right click on the name of your web page in the 'Remote' (TFN side) directory display, and a menu will pop up with 'CHMOD (UNIX)' near the bottom. Click on that, and you will see a dialog box with permissions checkboxes. Check the box for 'Owner Execute' and click on 'OK' to apply the changes.

This Mailform utility only works on TFN
Because it is executed by the server, the 'tfnmailform' cgi program must be located on the same server where your web pages are located.

Back Front Contact

Copyright © 2002 Toronto Free-Net Inc.