CGI Binaries

mailform

Sends form data through email in one of several formats.

Usage

<form method=POST action="/cgi-bin/mailform[?address]">

<input type=hidden name="mform-email" value="address">
<input type=hidden name="mform-subject" value="subject">
<input type=hidden name="mform-response" value="url">
<input type=hidden name="mform-encoding" value="method">

address email address to which to send the form data. Required field; a recipient must be specified.
subject text that will appear in the mail's Subject: field. Optional field; default is "prism form data".
url URL to which the browser will be sent after submitting the form. Optional field; no default.
method method by which the form data will be encoded before being mailed. The following methods are currently supported: raw, text, fold, uuencode, base64. Optional field; default is text.

Description

Mailform will send an email message to address containing the data from the form. If an address is specified in both the action and the mform-email field, the former takes precedence. The email message will have a subject of "subject" if specified, or the default subject if not.

If url is specified, after submitting the form the browser will be redirected to the URL, so that a thank-you or other suitable response can be given to the user submitting the form. If it is not specified, the browser will be sent a "Status: 204 - No Response" status code, and the browser will not be redirected to another document.

The method determines how the form data will be encoded in the email message. The supported methods are:
raw The raw URL-encoded string of form data, on a single line.

This has virtually the same effect as if a "mailto:" action had been used, instead of this cgi. However, many mail delivery agents, including sendmail, have limits on the length of lines in a message. Depending on what route the mail takes, and what mail agents it goes through, the line may be split at various places, data may be lost, or in general unpredictable results may occur. This method is not recommended for anything but the smallest forms.

text The form data is converted into simple human-readable output, in the form of "field = value" pairs.

This is similar to the output of the /cgi-bin/post-query included in many httpd distributions. The value or contents of each field are printed verbatim, including any newlines or tabs. Forms with multi-line fields such as textareas may produce less than desirable formatted output, and may be very difficult to parse. This method is best used for simple forms without textareas, or for just viewing the contents of the form without parsing or processing it.

This method is the default.

fold The raw form data piped through fold(1).

This splits the long, single-line raw data at regular intervals, to allow safe passage through mail delivery agents, and easy re-joining at the receiving end. The line is split at intervals of 75 characters.

uuencode The raw form data encoded via uuencode(1C).

The data is encoded with a filename of formdata.txt.

base64 The raw form data encoded in MIME's base64 format, via mimencode(1).

This is the recommended encoding method.

Notes

Mailform will unset its "mform*" recognized input fields - they will not appear in the encoded form data. This can be used to assist debugging. If the field appears in the form data, it was not recognized by mailform (possibly due to misspelling, etc).

In addition, it will add name/value pairs to the encoded form data according to the standard environment variables available to CGI programs. The following variables, if non-null, will be set in the encoded form data:

A final output variable will be added, MAILFORM_TIME, corresponding to the time mailform processed the form data.

Examples

Here is an example form, and here is an example output of each encoding method:


raw

From nobody@kaboom.gatech.edu  Tue Apr  2 12:49:41 1996
Date: Tue, 2 Apr 1996 12:49:39 -0500
Message-Id: <199604021749.AAA00011@kaboom.gatech.edu>
From: nobody@kaboom.gatech.edu (PRISM MailForm CGI)
Reply-To: nobody@kaboom.gatech.edu
Errors-To: nobody@kaboom.gatech.edu
X-Mailer: PRISM MailForm CGI
Mime-Version: 1.0
Content-Description: prism form data
To: gtgeopb@prism.gatech.edu
Subject: my data
Content-type: application/x-www-form-urlencoded
X-URL: http://www.prism.gatech.edu/~gtgeopb/myform.html

name=Joe&computer=Vic-20&comments=The+Vic-20+is+my+most+favoritest+computer+because+I+like+it+so+much+I+bought+one+when+I+was+a+kid+because+it+had+the+coolest+graphics+were+on+the+box+the+computer+came+in+the+mail+one+day+while+I+was+at+school+which+I+hated+because+show+and+tell+never+was+every+day+when+I+finally+took+my+Vic-20+to+class+and+everyone+like+it%2C+that%27s+why.%0D%0A%0D%0AThanks+you.&HTTP_REFERER=http%3A%2F%2Fwww.prism.gatech.edu%2F%7Egtgeopb%2Fmyform.html&HTTP_USER_AGENT=Mozilla%2F2.01+%28X11%3B+I%3B+SunOS+5.4+sun4m%29&REMOTE_HOST=joe.ppp.isp.com&REMOTE_ADDR=127.0.0.1&MAILFORM_TIME=Tue+Apr++2+12%3A49%3A38+1996%0A

text

From nobody@kaboom.gatech.edu  Tue Apr  2 13:03:46 1996
Date: Tue, 2 Apr 1996 13:03:43 -0500
Message-Id: <199604021803.AAA00012@kaboom.gatech.edu.gatech.edu>
From: nobody@kaboom.gatech.edu (PRISM MailForm CGI)
Reply-To: nobody@kaboom.gatech.edu
Errors-To: nobody@kaboom.gatech.edu
X-Mailer: PRISM MailForm CGI
Mime-Version: 1.0
Content-Description: prism form data
To: gtgeopb@prism.gatech.edu
Subject: my data
Content-type: text/plain
X-URL: http://www.prism.gatech.edu/~gtgeopb/myform.html

name = Joe
computer = Vic-20
comments = The Vic-20 is my most favoritest computer because I like it so much I bought one when I was a kid because it had the coolest graphics were on the box the computer came in the mail one day while I was at school which I hated because show and tell never was every day when I finally took my Vic-20 to class and everyone like it, that's why.

Thanks you.
HTTP_REFERER = http://www.prism.gatech.edu/~gtgeopb/myform.html
HTTP_USER_AGENT = Mozilla/2.01 (X11; I; SunOS 5.4 sun4m)
REMOTE_HOST = joe.ppp.isp.com
REMOTE_ADDR = 127.0.0.1
MAILFORM_TIME = Tue Apr  2 13:03:42 1996

fold

From nobody@kaboom.gatech.edu  Tue Apr  2 13:00:23 1996
Date: Tue, 2 Apr 1996 13:00:13 -0500
Message-Id: <199604021800.AAA00013@kaboom.gatech.edu.gatech.edu>
From: nobody@kaboom.gatech.edu (PRISM MailForm CGI)
Reply-To: nobody@kaboom.gatech.edu
Errors-To: nobody@kaboom.gatech.edu
X-Mailer: PRISM MailForm CGI
Mime-Version: 1.0
Content-Description: prism form data
To: gtgeopb@prism.gatech.edu
Subject: my data
Content-type: text/plain
X-URL: http://www.prism.gatech.edu/~gtgeopb/myform.html

name=Joe&computer=Vic-20&comments=The+Vic-20+is+my+most+favoritest+computer
+because+I+like+it+so+much+I+bought+one+when+I+was+a+kid+because+it+had+the
+coolest+graphics+were+on+the+box+the+computer+came+in+the+mail+one+day+whi
le+I+was+at+school+which+I+hated+because+show+and+tell+never+was+every+day+
when+I+finally+took+my+Vic-20+to+class+and+everyone+like+it%2C+that%27s+why
.%0D%0A%0D%0AThanks+you.&HTTP_REFERER=http%3A%2F%2Fwww.prism.gatech.edu%2F%
7Egtgeopb%2Fmyform.html&HTTP_USER_AGENT=Mozilla%2F2.01+%28X11%3B+I%3B+SunOS
+5.4+sun4m%29&REMOTE_HOST=joe.ppp.isp.com&REMOTE_ADDR=127.0.0.1&MAILFORM_TI
ME=Tue+Apr++2+13%3A00%3A13+1996%0A

uuencode

From nobody@kaboom.gatech.edu  Tue Apr  2 13:07:07 1996
Date: Tue, 2 Apr 1996 13:07:03 -0500
Message-Id: <199604021807.AAA00014@kaboom.gatech.edu.gatech.edu>
From: nobody@kaboom.gatech.edu (PRISM MailForm CGI)
Reply-To: nobody@kaboom.gatech.edu
Errors-To: nobody@kaboom.gatech.edu
X-Mailer: PRISM MailForm CGI
Mime-Version: 1.0
Content-Description: prism form data
To: gtgeopb@prism.gatech.edu
Subject: my data
Content-type: application/x-www-form-urlencoded
Content-Transfer-Encoding: x-uue
X-URL: http://www.prism.gatech.edu/~gtgeopb/myform.html

begin 666 formdata.txt
M;F%M93U*;V4F8V]M<'5T97(]5FEC+3(P)F-O;6UE;G1S/51H92M6:6,M,C K
M:7,K;7DK;6]S="MF879O<FET97-T*V-O;7!U=&5R*V)E8V%U<V4K22ML:6ME
M*VET*W-O*VUU8V@K22MB;W5G:'0K;VYE*W=H96XK22MW87,K82MK:60K8F5C
M875S92MI="MH860K=&AE*V-O;VQE<W0K9W)A<&AI8W,K=V5R92MO;BMT:&4K
M8F]X*W1H92MC;VUP=71E<BMC86UE*VEN*W1H92MM86EL*V]N92MD87DK=VAI
M;&4K22MW87,K870K<V-H;V]L*W=H:6-H*TDK:&%T960K8F5C875S92MS:&]W
M*V%N9"MT96QL*VYE=F5R*W=A<RME=F5R>2MD87DK=VAE;BM)*V9I;F%L;'DK
M=&]O:RMM>2M6:6,M,C K=&\K8VQA<W,K86YD*V5V97)Y;VYE*VQI:V4K:70E
M,D,K=&AA="4R-W,K=VAY+B4P1"4P024P1"4P051H86YK<RMY;W4N)DA45%!?
M4D5&15)%4CUH='1P)3-!)3)&)3)&=W=W+G!R:7-M+F=A=&5C:"YE9'4E,D8E
M-T5G=&=E;W!B)3)&;7EF;W)M+FAT;6PF2%144%]54T527T%'14Y4/4UO>FEL
M;&$E,D8R+C Q*R4R.%@Q,24S0BM))3-"*U-U;D]3*S4N-"MS=6XT;24R.292
M14U/5$5?2$]35#UJ;V4N<'!P+FES<"YC;VTF4D5-3U1%7T%$1%(],3(W+C N
M,"XQ)DU!24Q&3U)-7U1)344]5'5E*T%P<BLK,BLQ,R4S03 W)3-!,#,K,3DY
%-B4P00I!
 
end

base64

From nobody@kaboom.gatech.edu  Tue Apr  2 16:04:27 1996
Date: Tue, 2 Apr 1996 16:04:16 -0500
Message-Id: <199604022104.AAA00015@kaboom.gatech.edu.gatech.edu>
From: nobody@kaboom.gatech.edu (PRISM MailForm CGI)
Reply-To: nobody@kaboom.gatech.edu
Errors-To: nobody@kaboom.gatech.edu
X-Mailer: PRISM MailForm CGI
Mime-Version: 1.0
Content-Description: prism form data
To: gtgeopb@prism.gatech.edu
Subject: my data
Content-type: application/x-www-form-urlencoded
Content-Transfer-Encoding: base64
X-URL: http://www.prism.gatech.edu/~gtgeopb/myform.html

bmFtZT1Kb2UmY29tcHV0ZXI9VmljLTIwJmNvbW1lbnRzPVRoZStWaWMtMjAraXMrbXkrbW9z
dCtmYXZvcml0ZXN0K2NvbXB1dGVyK2JlY2F1c2UrSStsaWtlK2l0K3NvK211Y2grSStib3Vn
aHQrb25lK3doZW4rSSt3YXMrYStraWQrYmVjYXVzZStpdCtoYWQrdGhlK2Nvb2xlc3QrZ3Jh
cGhpY3Mrd2VyZStvbit0aGUrYm94K3RoZStjb21wdXRlcitjYW1lK2luK3RoZSttYWlsK29u
ZStkYXkrd2hpbGUrSSt3YXMrYXQrc2Nob29sK3doaWNoK0kraGF0ZWQrYmVjYXVzZStzaG93
K2FuZCt0ZWxsK25ldmVyK3dhcytldmVyeStkYXkrd2hlbitJK2ZpbmFsbHkrdG9vaytteStW
aWMtMjArdG8rY2xhc3MrYW5kK2V2ZXJ5b25lK2xpa2UraXQlMkMrdGhhdCUyN3Mrd2h5LiUw
RCUwQSUwRCUwQVRoYW5rcyt5b3UuJkhUVFBfUkVGRVJFUj1odHRwJTNBJTJGJTJGd3d3LnBy
aXNtLmdhdGVjaC5lZHUlMkYlN0VndGdlb3BiJTJGbXlmb3JtLmh0bWwmSFRUUF9VU0VSX0FH
RU5UPU1vemlsbGElMkYyLjAxKyUyOFgxMSUzQitJJTNCK1N1bk9TKzUuNCtzdW40bSUyOSZS
RU1PVEVfSE9TVD1qb2UucHBwLmlzcC5jb20mUkVNT1RFX0FERFI9MTI3LjAuMC4xJk1BSUxG
T1JNX1RJTUU9VHVlK0FwcisrMisxNiUzQTA0JTNBMTYrMTk5NiUwQQo=

See Also

mimencode(1), fold(1), uuencode(1C)

Authors

Will Day
Drew Gonczi

Last change: 2 May 1996


[BACK]
contact: webmaster@www.prism.gatech.edu
Last updated Monday, 28-Feb-05