Tips & Tricks

CLA Technical Support
Account Request
College Faculty & Staff
Equipment Database
Tips & Tricks
Useful Downloads
Work Orders
Workshop Projects

How to E-mail Forms

The following examples describe how to send the contents of an HTML form to an email address with optional courtesy reply email and/or HTML "Thank You" page.

Basic syntax and minimum required fields
Common optional fields
Returning a courtesy reply
Returning an HTML "Thank You" page
Example form using most common fields
Complete field definitions

Basic syntax and minimum required fields

Include the following code to have your form values emailed to youremail address:

<FORM method="POST" action="/cgi-bin/yform">
<INPUT type=hidden name="mail_recipient" value="youremail@your.host.com">
<INPUT type=hidden name="mail_listfields" value="value">
.
.
.
<INPUT type=submit value="Submit">
</FORM>

top

Common optional fields

In addition to the basic syntax above, the following code can be used to add a subject line and require and sort fields in the users reply:

Require fields
<INPUT type=hidden name="required" value="name,email">

Set the order of fields in the reply
<INPUT type=hidden name="sort" value="order:name,email">

Set the subject line in the reply
<INPUT type=hidden name="mail_subject" value="Email FORM Response">

top

Retuning a courtesy reply

In addition to the basic syntax above, add the following code to your form to have a courtesy reply sent to the user's email address:

<INPUT type=hidden name="cour_send" value="value">
<INPUT type=hidden name="cour_listfields" value="value">
.
.
.
Your full name: <BR>
<INPUT type=text name="name"><BR>
Email Address: <BR>
<INPUT type=text name="email"><BR>

top

Returning an HTML "Thank You" page

In addition to the basic syntax above add the following code to your form to have an HTML page displayed to the user:

<INPUT type=hidden name="html_title" value="Thank You">
<INPUT type=hidden name="html_top" value="This text prints above the field list">
<INPUT type=hidden name="html_listfields" value="value">
<INPUT type=hidden name="html_bottom" value="This text prints below the field list.">

If you want to include a return link other than the back button add these two lines:

<INPUT type=hidden name="html_return_link_title" value="Click here to return to the main CLA Tech page.">
<INPUT type=hidden name="html_return_link_url" value="http://cla.calpoly.edu/cla/tech/">

top

Example of a complete form

The following sample form -- actual code used to request accounts on this server -- collects and sends user information to the server administrator, it then returns an HTML acknowledgment page for the user. No courtesy replay is e-mailed to the user, however one could be added by following the instructions above.

<P><FORM ACTION="/cgi-bin/yform" METHOD=POST>
<P><INPUT TYPE=hidden NAME=required VALUE="name,email,phone,department,affiliation,usage">
<INPUT TYPE=hidden NAME=sort VALUE="order:name,email,phone,department,affiliation, usage,sname,semail,sphone,sdepartment,comments">
<INPUT TYPE=hidden NAME="mail_recipient" VALUE="tdresel@calpoly.edu">
<INPUT TYPE=hidden NAME="mail_subject" VALUE="CLA Web Account Request">
<INPUT TYPE=hidden NAME="mail_top" VALUE="The following person has requested an account on the CLA Web Server:">
<INPUT TYPE=hidden NAME="mail_listfields" VALUE=value>
<INPUT TYPE=hidden NAME="html_title" VALUE="CLA Request Submitted">
<INPUT TYPE=hidden NAME="html_top" VALUE="A request has been made for a CLA Web Server account in the following name:">
<INPUT TYPE=hidden NAME="html_listfields" VALUE=value>
<INPUT TYPE=hidden NAME="html_bottom" VALUE="You will be provided more information after the account has be created.">
<INPUT TYPE=hidden NAME="html_return_link_title" VALUE="Click here to return to the main CLA Tech page.">
<INPUT TYPE=hidden NAME="html_return_link_url" VALUE="http://cla.calpoly.edu/cla/tech/index.html"></P>

<P><TABLE BORDER=3 BGCOLOR="#99CCFF" CELLPADDING=4 WIDTH="100%">
   <TR>
      <TD VALIGN=top>
         <P><I>Faculty/Staff Name:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=text NAME=name VALUE="" SIZE=28><BR>
         <FONT SIZE="-1">Person ultimately responsible for this
          account</FONT></P>

         <P><I>E-mail Address:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=text NAME=email VALUE="" SIZE=25><BR>
         <BR>
         <I>Cal Poly Affiliation:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=radio NAME=affiliation VALUE=Faculty>Faculty
         <INPUT TYPE=radio NAME=affiliation VALUE=Staff>Staff
         <INPUT TYPE=radio NAME=affiliation VALUE=Student>Student
         <INPUT TYPE=radio NAME=affiliation VALUE=Other>Other</P>
      </TD>
      <TD VALIGN=top>
         <P><I>Phone Number:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=text NAME=phone VALUE="" SIZE=10></P>

         <P><BR>
         <I>Department:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=text NAME=department VALUE="" SIZE=28><BR>
         <BR>
         <I>Proposed use for web account:
         </I><FONT SIZE="-1"><I>(required)</I></FONT><BR>
         <INPUT TYPE=radio NAME=usage VALUE=Personal>Personal
         <INPUT TYPE=radio NAME=usage VALUE=Departmental>Departmental
         <INPUT TYPE=radio NAME=usage VALUE=Student>Student
         <INPUT TYPE=radio NAME=usage VALUE=Special>Special Project
         <INPUT TYPE=radio NAME=usage VALUE=Other>Other</P>
      </TD>
   </TR>
   <TR>
      <TD VALIGN=top>
         <P><I>If Student Name: </I><BR>
         <INPUT TYPE=text NAME=sname VALUE="" SIZE=28><BR>
         <I>E-mail Address: </I><BR>
         <INPUT TYPE=text NAME=semail VALUE="" SIZE=25><BR>
         </P>
      </TD>
      <TD VALIGN=top>
         <P><I>Phone Number: </I><BR>
         <INPUT TYPE=text NAME=sphone VALUE="" SIZE=10><BR>
         <I>Department: </I><BR>
         <INPUT TYPE=text NAME=sdepartment VALUE="" SIZE=28><BR>
         </P>
      </TD>
   </TR>
   <TR>
      <TD ALIGN=center COLSPAN=2>
         <P><I>Please include any special instructions or comments
          that you feel are relevant about this request, i.e. account
          usage, group access, department account, etc.</I><BR>
         <TEXTAREA NAME=comments ROWS=5 COLS=63 WRAP=virtual>
         </TEXTAREA><BR>
         </P>

         <P><B>Please note:</B> Incomplete forms will not be
          processed.</P>

         <P><INPUT TYPE=submit NAME=Submit VALUE="Submit">
         <INPUT TYPE=reset VALUE="Reset"></P>
      </TD>
   </TR>
</TABLE>
</FORM></P>

top

CLA Technical Support | Account Request | College Faculty & Staff | Equipment Database | Tips & Tricks | Useful Downloads | Work Orders | Workshop Projects

 

Tom Dresel
tdresel@calpoly.edu
Date Last Modified: 1/25/01