|
Division of Information Technology Web Publishing @ SFSU CGIEMAIL |
A copy of the CGIEMAIL User's Guide is available for detail information.
An advanced guide shows several of the new features.
Basic Steps
E-mail Template Example
The first part of using the program is to design your form. Look at our online Forms instructions or NCSA's information on Forms. The following example from the Forms page has one of each of the entry field types.
The actual form looks like this.
Success and Failure Fields You can send the recipient to a second page or URL after they submit the form. If you wanted to send the user to another page after they have successfully completed the submitted the form, you would use this field in your form:
<input type="hidden" name="success" value="http://server.sfsu.edu/~accountname/completed.htm">
If the user had submitted an incomplete form you would use:
<input type="hidden" name="failure" value="http://server.sfsu.edu/~accountname/formfailed.htm">
Addendum Field You can send the recipient a message in response. This is done by using fields with the input type of "hidden". To send a text response that said "Thank You" you would use this field:
<input type="hidden" name="addendum" value="Thank You">
The following sample templates matche the code above.
From: [email]
To: your-email-address@sfsu.edu
Subject: Sample Form
Year: [year]
Group: [group]
Term: [term]
Major: [major]
My comments:
[comments]
The name of the field to be substituted is placed in square brackets []. The SFSU mail system requires the first and second lines of the template to start with 'From:' and 'To:' respectively. The subject can be any text, this is what will appear in the subject field of the mail application. You can include form values in the headers, for example, if the email address was one of the form fields (as in the example), you could have the first line of your template include it. You would use From: [email] to fill in a person's email address if they have entered it on the form.
This combination of the form and template above would provide the following output:
From:
To: your-email-address@sfsu.edu
Subject: Sample Questionnaire
Year: 1999
Group: Student
Term: spring
Major: Accounting
My comments:
users comments
From: [email]
To: your-email-address@sfsu.edu
Subject: Sample Questionnaire
[student],[term],[major],[comments],[month],[day],[year]
The advantage to delimiting your responses is that it allows you to manipulate the data easily in a spreadsheet or database program. In this example commas are used however if the user enters commas in the text area of the form it may result in errors when importing the data into a database or spreadsheet. You can use other special characters as delimiters.
Example:
<form METHOD="POST" ACTION="/cgi-bin/cgiemail/~accountname/feedback.txt">
This tells the CGIEMAIL program to process the form with the template file.
<form METHOD="POST" ACTION="/cgi-bin/cgiecho/~accountname/feedback.txt">
Example:
From: [email] (optional)
To: your-email-address
Subject: Sample Form
Student: [student]
Term: [term]
Major: [major]
My comments:
[comments]
If everything worked, a page will be displayed showing the information submitted. If instead you see an error with a number near 500, your ACTION is probably set wrong. Go back to the previous step. If some of your inputs don't seem to be showing up in the processed form, make sure that the inputs have the exact same names in the HTML form as in the template.
Processed form looks like this:
From:
To: your-email-address
Subject: Sample Form
Date 01/01/1999
Group: student
Term: summer
Major: Accounting
My comments:
If the information returned was by CGIECHO was correct make the form live by replacing cgiecho with cgiemail in your html file (feedback.htm).
<form METHOD="POST" ACTION="/cgi-bin/cgiemail/~accountname/feedback.txt">
| Some mailto Form Parsers for Macintosh | Mail to Converter Mail to Tamer |
Home
Search
Need Help?
1600 Holloway Avenue, San Francisco, CA 94132 (415) 338-1111
Last modified February 11, 2008 by the Web Team