# FormMail

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/FormMail
> Markdown URL: https://mediated.wiki/source/FormMail.md
> Source: https://en.wikipedia.org/wiki/FormMail
> Source revision: 1127929717
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

**Formmail** and its many variants, is a free open source [web server](/source/Web_server) [CGI script](/source/CGI_script) that captures and processes [form](/source/Form_(web)) contents and then typically e-mails them to one or more recipients.

The script, originally created in [Perl](/source/Perl), was originally written in early 1993 by Reuven M. Lerner, as part of his work on [The Tech](/source/The_Tech_(newspaper)), and was included in the archive of CGI programs made available by [NCSA HTTPd](/source/NCSA_HTTPd). In its original form, it was called "form-mail.pl", and was released under the [GNU General Public License](/source/GNU_General_Public_License).

The program was subsequently stripped of its copyright and authorship, renamed "FormMail", and publicized by Matt Wright as part of [Matt's Script Archive](/source/Matt's_Script_Archive).

## 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](/source/CAPTCHA) validation and more.

Today a variant of the script exists for most popular web [scripting languages](/source/Scripting_language), such as Perl, [ASP](/source/Active_Server_Pages) (ASP.NET), [PHP](/source/PHP), [ColdFusion](/source/ColdFusion), and [Java](/source/Java_(programming_language)).

## See also

- [History of the World Wide Web](/source/History_of_the_World_Wide_Web)

- [Sendmail](/source/Sendmail)

## References

## External links

- [Matt's Original FormMail](http://www.scriptarchive.com/formmail.html)

- [JFormMail - WWW Form Processor in Java](https://jformmail.sourceforge.net/)

- [PHP FormMail - Tectite](http://www.tectite.com/formmailpage.php)

- [FormMail++](http://www.johnwoodruff.com/FormMail++)

---
Adapted from the Wikipedia article [FormMail](https://en.wikipedia.org/wiki/FormMail) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/FormMail?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
