**WEBTEAM
Form2mail CGI-script

There is a CGI script on Global written by Ingimar Robertsson which takes the data submitted from a Webform, formats the data nicely and sends it to a specific email. This can be used to provide somewhat more readable format than if the form uses the ‘mailto:’ action. To use the script, the ACTION field of the form must point to the script. For example:

  • <FORM METHOD="post" ACTION="/cgi-bin/form2mail">

Two tags are needed to define the email address of the person who should receive the data and the subject of the letter (actually the subject is optional). These two tags must look like this:

  • <INPUT TYPE="hidden" NAME="mailto" VALUE="ingimarr@kidlink.org">
  • <INPUT TYPE="hidden" NAME="subject" VALUE="Data from WWW form">

In this example the data submitted by the form will be sent to:

ingimarr@kidlink.org with the subject "Data from WWW form".

Please note that you can't have any other fields in the form with the name ‘mailto:’ or ‘subject’ since these have been reserved for the CGI script. Here's a complete example of a page with a form using form2mail, the main lines as outlined above are bulleted:

<HTML>
<HEAD> <TITLE>Comments form</TITLE> </HEAD>
<BODY>

If you'd like to send comments to Ingimar please use this form:

  • <FORM METHOD="post" ACTION="/cgi-bin/form2mail">
  • <INPUT TYPE="hidden" NAME="mailto" VALUE="ingimarr@kidlink.org">
  • <INPUT TYPE="hidden" NAME="subject" VALUE="Comments from WWW">

Name: <INPUT TYPE="text" NAME="fullname" SIZE=45><BR>
Email: <INPUT TYPE="text" NAME="email" SIZE=45><BR>
Comments:<BR>
<TEXTAREA NAME="comments" ROWS=5 COLS=45>Dear Ingimar</TEXTAREA><BR>
</FORM>
</BODY>
</HTML>

If you have any questions please contact Ingimar Robertsson.

For practical applications of the form2mail script please see:


--------------------------------------------------


Page updated

Page maintained by: Stellan Kinberg
KIDLINK Copyright ® 2001 . All rights reserved.