FormMail
Encyclopedia
Formmail and its many variants, is a free open source web server
Web server
Web server can refer to either the hardware or the software that helps to deliver content that can be accessed through the Internet....

 CGI script that captures and processes form
Form (web)
A webform on a web page allows a user to enter data that is sent to a server for processing. Webforms resemble paper or database forms because internet users fill out the forms using checkboxes, radio buttons, or text fields...

 contents and then typically e-mails them to one or more recipients.

The script, originally created in Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

, is credited to Matt Wright of Matt's Script Archive and is available today in many web programming languages.

Operation

The script operates by iteratively reading all the form fields from the submitted form via the form ACTION tag. Next the script begins to build an e-mail message from the submitted fields, typically concatenating the name and value of each submitted form field in the body of the email message.

The script uses several specially-named hidden fields to control the operation of the script. The various hidden fields control who the recipient of the e-mail is, what the email subject is set to, etc. Finally the script e-mails the form's contents to the recipient(s).

The typical FormMail script has this common functionality:
  • Reads all form fields and creates an e-mail message from them
  • Recipient fields (typically hidden) allow creator to determine e-mail recipient
  • Subject field, allows the creator to set the Subject of the e-mail in a hidden form field
  • Required fields, allows you to set which fields need to be completed to send the e-mail
  • CC, BCC fields, allow you to copy and forward to multiple recipients


More advanced variants of the script have additional features such as: provide for e-mail attachments, prevent form spamming, save the e-mail to a file or database, add CAPTCHA
CAPTCHA
A CAPTCHA is a type of challenge-response test used in computing as an attempt to ensure that the response is generated by a person. The process usually involves one computer asking a user to complete a simple test which the computer is able to generate and grade...

 validation and more.

Today a variant of the script exists for most popular web scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

s, such as Perl, ASP
Active Server Pages
Active Server Pages , also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically-generated Web pages. Initially released as an add-on to Internet Information Services via the Windows NT 4.0 Option Pack Active Server Pages (ASP), also known as Classic...

 (ASP.NET) , PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

, ColdFusion
ColdFusion
In computing, ColdFusion is the name of a commercial rapid application development platform invented by Jeremy and JJ Allaire in 1995. ColdFusion was originally designed to make it easier to connect simple HTML pages to a database, by version 2 it had...

, and Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK