Forms.acgi Information Sheet


Abstract:

This program was designed to solve a very simple problem: to take the data from a form and mail it to an e-mail address (while using a Mac web server). Until now the only way you could do this was to use MacPerl or Applescript which works fairly well, but I wasn't pleased with how long it took to generate a response for the end user. After discovering how well-written John Norstad's Mail Tools Gateway was, I immediately started hacking at it until it would solve my form/mail problem. I've been extremely impressed with how fast and efficient John's code is even after I've gone in and kludged my way around.

I hope you enjoy using this as much as I have. If you want a more detailed description of how this cgi works, then please read John's Mail Tools Technical Information page. The on-line version of this ReadMe can be found here.

Key Features:
Uses hidden fields in form for "To:", "From:", "Subject:", and the SMTP host

Modifiable standard header and footer with ResEdit

Extremely fast threaded ACGI

Written entirely in Metrowerks Codewarrior

Fat binary (works on both 68k and PowerMac)

 
Requirements:
A Mac with System 7.0 or higher

Webstar, MacHTTP, Netpresenz, Webserver 4D, or any other Macintosh web server that supports CGIs.

Thread Manager (integrated with 7.5)

Access to an SMTP server

 

Download:
Forms.acgi application package This is only for your Mac webserver. You do not need this to call the forms from your webpage html code.

 

Customizing Forms.acgi: 
Open Forms.acgi with ResEdit and change the following:
CNFG 128 = Set maximum number of threads, how long it stays open, etc.
STR# 129 = Change e-mail addresses, alter response message
TEXT 129 = Change standard header that shows after a form is submitted (sucess & failure)
TEXT 130 = Change standard footer that shows after a form is submitted (sucess & failure)
TEXT 131 = Change form that's returned when acgi is called directly
 

The following field names have special meanings:

mailto = "To:" address for e-mail message (required - must be in user@host.domain format)
mailfrom = "From:" address for e-mail message (required - must be in user@host.domain format)
mailsubject = "Subject:" line for e-mail message
smtphost = SMTP host that acgi sends message through (required)
KILL = makes Forms.acgi quit as soon as possible
header = Allows each form to have a different response header
 

You can put a '*' before any field name to keep it out of the e-mail response.

 

Any of those fields can be of type "hidden" so they don't show up on the form. 

Example:

Send yourself a test message: 

Your name:

Your e-mail address:

Subject:

Comments or Questions:

 


The above form was made with this:

<FORM ACTION="http://www.sbamug.com/cgi-bin/RWforms.acgi" METHOD=POST>
<P><FONT SIZE="+2"><STRONG>Send yourself a test message:</STRONG></FONT>
<P>Your name: <INPUT TYPE=text NAME=Name VALUE="" SIZE=30 MAXLENGTH=50>
<P>Your e-mail address: <INPUT TYPE=text NAME="*mailto" VALUE="" SIZE=30 MAXLENGTH=50>
<P>Subject: <INPUT TYPE=text NAME="*mailsubject" VALUE="" SIZE=30 MAXLENGTH=50>
<P>SMTP Host: <INPUT TYPE=hidden NAME="*smtphost" VALUE="sbamug.com" SIZE=30>

<P>Comments or Questions:
<P><TEXTAREA NAME=Comments ROWS=10 COLS=50 WRAP=virtual>I love Macs!!!</TEXTAREA>
<P><INPUT TYPE=submit NAME=Submit VALUE="Send Message">
<INPUT TYPE=reset VALUE="Clear Message">
<INPUT TYPE=hidden NAME="*mailfrom" VALUE="forms.acgi-test@nowhere.foo">
</FORM>

If you want to make a web form that is mailed to YOU, then you need to make several adjustments. See the Bold below.


<FORM ACTION="http://www.sbamug.com/cgi-bin/RWforms.acgi" METHOD=POST>
<P><FONT SIZE="+2"><STRONG>Send me a message:</STRONG></FONT>
<P>Your name: <INPUT TYPE=text NAME=Name VALUE="" SIZE=30 MAXLENGTH=50>
<P>Your e-mail address: <INPUT TYPE=text NAME="*mailfrom" VALUE="" SIZE=30 MAXLENGTH=50>
<P>Subject: <INPUT TYPE=text NAME="*mailsubject" VALUE="" SIZE=30 MAXLENGTH=50>
<P>SMTP Host: <INPUT TYPE=text NAME="*smtphost" VALUE="sbamug.com" SIZE=30>

<P>Comments or Questions:
<P><TEXTAREA NAME=Comments ROWS=10 COLS=50 WRAP=virtual>I love Macs!!!</TEXTAREA>
<P><INPUT TYPE=submit NAME=Submit VALUE="Send Message">
<INPUT TYPE=reset VALUE="Clear Message">
<INPUT TYPE=hidden NAME="*mailto" VALUE="youremail@server.com">
</FORM>


You can add fields as you like, just use them and they will exist. Look at this working form as an example.