{
    "content": [
        {
            "type": "text",
            "text": "# CGI::Application::Mailform (perldoc)\n\n## NAME\n\nCGI::Application::Mailform - A simple HTML form to email system\n\n## SYNOPSIS\n\n## In \"mailform.cgi\" --\nuse CGI::Application::Mailform;\n# Create a new Mailform instance...\nmy $mf = CGI::Application::Mailform->new();\n# Configure your mailform\n$mf->param('MAILFROM'   => 'webmaster@your.domain');\n$mf->param('MAILTO'     => 'formrecipient@your.domain');\n$mf->param('HTMLFORMREDIRECTURL' => '/uri/or/url/to/mailform.html');\n$mf->param('SUCCESSREDIRECTURL'  => '/uri/or/url/to/thankyou.html');\n$mf->param('FORMFIELDS' => [qw/name address comments etc/]);\n# Optional variables\n$mf->param('SMTPHOST'   => 'mail.your.domain');\n$mf->param('SUBJECT'     => 'New form submission');\n$mf->param('ENVFIELDS'  => [qw/REMOTEADDR HTTPUSERAGENT/]);\n# Now run...\n$mf->run();\nexit(0);\n## In \"mailform.html\" --\n<form action=\"mailform.cgi\">\n<input type=\"hidden\" name=\"rm\" value=\"submitform\">\n<!-- Your HTML form input fields here -->\n<input type=\"submit\" name=\"submit\">\n</form>\n## In \"thankyou.html\" --\n<html><body>\n<h1>Thanks for your submission!  It has been sent.</h1>\n</body></html>\n\n## DESCRIPTION\n\nCGI::Application::Mailform is a reusable and customizable mailform for the web. It is\nintentionally simple, and provides very few facilities. What it does do is provide an\neasy-to-use, secure system for taking the contents of a HTML form submission and sending it, via\nemail, to a specified recipient.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (3 subsections)\n- **SEE ALSO**\n- **AUTHOR**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CGI::Application::Mailform",
        "section": "",
        "mode": "perldoc",
        "summary": "CGI::Application::Mailform - A simple HTML form to email system",
        "synopsis": "## In \"mailform.cgi\" --\nuse CGI::Application::Mailform;\n# Create a new Mailform instance...\nmy $mf = CGI::Application::Mailform->new();\n# Configure your mailform\n$mf->param('MAILFROM'   => 'webmaster@your.domain');\n$mf->param('MAILTO'     => 'formrecipient@your.domain');\n$mf->param('HTMLFORMREDIRECTURL' => '/uri/or/url/to/mailform.html');\n$mf->param('SUCCESSREDIRECTURL'  => '/uri/or/url/to/thankyou.html');\n$mf->param('FORMFIELDS' => [qw/name address comments etc/]);\n# Optional variables\n$mf->param('SMTPHOST'   => 'mail.your.domain');\n$mf->param('SUBJECT'     => 'New form submission');\n$mf->param('ENVFIELDS'  => [qw/REMOTEADDR HTTPUSERAGENT/]);\n# Now run...\n$mf->run();\nexit(0);\n## In \"mailform.html\" --\n<form action=\"mailform.cgi\">\n<input type=\"hidden\" name=\"rm\" value=\"submitform\">\n<!-- Your HTML form input fields here -->\n<input type=\"submit\" name=\"submit\">\n</form>\n## In \"thankyou.html\" --\n<html><body>\n<h1>Thanks for your submission!  It has been sent.</h1>\n</body></html>",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 28,
                "subsections": [
                    {
                        "name": "Create 'mailform.html'",
                        "lines": 27
                    },
                    {
                        "name": "Create 'thankyou.html'",
                        "lines": 22
                    },
                    {
                        "name": "Create 'mailform.cgi'",
                        "lines": 168
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CGI::Application::Mailform - A simple HTML form to email system\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "## In \"mailform.cgi\" --\nuse CGI::Application::Mailform;\n\n# Create a new Mailform instance...\nmy $mf = CGI::Application::Mailform->new();\n\n# Configure your mailform\n$mf->param('MAILFROM'   => 'webmaster@your.domain');\n$mf->param('MAILTO'     => 'formrecipient@your.domain');\n$mf->param('HTMLFORMREDIRECTURL' => '/uri/or/url/to/mailform.html');\n$mf->param('SUCCESSREDIRECTURL'  => '/uri/or/url/to/thankyou.html');\n$mf->param('FORMFIELDS' => [qw/name address comments etc/]);\n\n# Optional variables\n$mf->param('SMTPHOST'   => 'mail.your.domain');\n$mf->param('SUBJECT'     => 'New form submission');\n$mf->param('ENVFIELDS'  => [qw/REMOTEADDR HTTPUSERAGENT/]);\n\n# Now run...\n$mf->run();\nexit(0);\n\n\n\n## In \"mailform.html\" --\n<form action=\"mailform.cgi\">\n<input type=\"hidden\" name=\"rm\" value=\"submitform\">\n<!-- Your HTML form input fields here -->\n<input type=\"submit\" name=\"submit\">\n</form>\n\n\n\n## In \"thankyou.html\" --\n<html><body>\n<h1>Thanks for your submission!  It has been sent.</h1>\n</body></html>\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "CGI::Application::Mailform is a reusable and customizable mailform for the web. It is\nintentionally simple, and provides very few facilities. What it does do is provide an\neasy-to-use, secure system for taking the contents of a HTML form submission and sending it, via\nemail, to a specified recipient.\n\nThis module was created as an example of how to use CGI::Application, a framework for creating\nreusable web-based applications. In addition to providing a simple example of CGI::Application's\nusage, CGI::Application::Mailform is also a fully functional application, capable of running in\na production environment.\n\nJust as is the case with any web-application built upon CGI::Application,\nCGI::Application::Mailform will run on any web server and operating system which supports the\nCommon Gateway Interface (CGI). It will run equally well on Apache as it runs on IIS or the\niPlanet server. It will run perfectly well on UNIX, Linux, Solaris or Windows NT. It will take\nfull advantage of the advanced capabilities of MODPERL. It will probably even run under FastCGI\n(although the author has not personally tested it in that environment).\n\nUSAGE\nOnce CGI::Application::Mailform has been installed, you must complete the following steps to\ncreate a custom mailform on your website:\n\n1. Create 'mailform.html'\n2. Create 'thankyou.html'\n3. Create 'mailform.cgi'\n\nExamples of these files are provided in the directory \"Examples\" which can be found in the\ninstallation tar file for CGI::Application.\n",
                "subsections": [
                    {
                        "name": "Create 'mailform.html'",
                        "content": "The file 'mailform.html' is simply an HTML file which contains your web form. This is the form\nwhose contents will be sent, via CGI::Application::Mailform, to the specified recipient's email\naddress.\n\nThis file need only contain the basic HTML form. There are two requirements for this form.\nFirst, the \"action\" attribute of the <form> element must refer to the CGI instance script\n('mailform.cgi') you are about to create. Second, the form must set a \"hidden\" form field with\nthe name \"rm\" and the value \"submitform\". This hidden parameter is what tells the\nCGI::Application::Mailform application to send the email message, as opposed to send the user to\nthe HTML form.\n\nFor example:\n\n<form action=\"mailform.cgi\">\n<input type=\"hidden\" name=\"rm\" value=\"submitform\">\n<!-- Your HTML form input fields go here -->\n</form>\n\nYour 'mailform.html' may also contain JavaScript to provide form validation. The\nCGI::Application::Mailform does not (currently) have any internal form validation capabilities.\nAs described earlier, this is a very simple system. If it is necessary to enforce any fields as\n\"required\", it is recommended that JavaScript be used.\n\nNOTE: It is not necessary that your HTML file be called 'mailform.html'. You may name this file\nanything you like. The only naming limitation is that the name of this file should be correctly\nreferenced in your 'mailform.cgi', in the variable 'HTMLFORMREDIRECTURL'.\n"
                    },
                    {
                        "name": "Create 'thankyou.html'",
                        "content": "The next file you need to create is your 'thankyou.html' file. This file is the simplest of all.\nThis is the file to which users will be redirected once they have successfully submitted their\nform data. The purpose of this screen is to inform and assure the user that their form data\nsubmission has been successfully received and processed.\n\nFor example:\n\n<html>\n<head>\n<title>Thank you!</title>\n</head>\n<body>\n<p><h1>Thanks for your submission!</h1></p>\n<p>We have received your form, and\nwe will get back to you shortly.</p>\n</body>\n</html>\n\nNOTE: It is not necessary that your HTML file be called 'thankyou.html'. You may name this file\nanything you like. The only naming limitation is that the name of this file should be correctly\nreferenced in your 'mailform.cgi', in the variable 'SUCCESSREDIRECTURL'.\n"
                    },
                    {
                        "name": "Create 'mailform.cgi'",
                        "content": "The file 'mailform.cgi' is where all the functionality of CGI::Application::Mailform is\nconfigured. This file is referred to as a \"CGI instance script\" because it creates an \"instance\"\nof your form. A single website may have as many instance scripts as needed. All of these\ninstance scripts may use CGI::Application::Mailform. They may each use a different form (with\ndifferent fields, etc.) if desired. The ability to create multiple instances of a single\napplication, each with a different configuration is one of the benefits of building web-based\napplications using the CGI::Application framework.\n\nYour instance script, 'mailform.cgi', must be created in such a way that it is treated by your\nweb server as an executable CGI application (as opposed to a document). Generally (on UNIX),\nthis entails setting the \"execute bit\" on the file and configuring your web server to treat\nfiles ending \".cgi\" as CGI applications. Please refer to your particular web server's manual for\nconfiguration details.\n\nYour instance script 'mailform.cgi' must start with the following:\n\n#!/usr/bin/perl -w\nuse CGI::Application::Mailform;\nmy $mf = CGI::Application::Mailform->new();\n\nThese lines invoke the Perl interpreter, include the CGI::Application::Mailform module, and\ninstantiate a Mailform object, respectively. (The author assumes your Perl binary is located at\n\"/usr/bin/perl\". If it is not, change the first line to refer to the correct location of your\nPerl binary.)\n\nOnce you have a Mailform object ($mf), you have to configure the Mailform for your particular\napplication. This is done by using the param() method to set a number of variables. These\nvariables are specified as follows.\n\nREQUIRED VARIABLES\n\nMAILFROM\n$mf->param('MAILFROM' => 'webmaster@your.domain');\n\nThis variable specifies the email address from which the email created by this mailform will\nappear to be sent. This can be any address you like. Typically, this will be\n\"webmaster@your.domain\". Keep in mind, this is the address to which a bounce or a reply will\nbe sent if one is generated as a result of the mailform email. The MAILFROM can also be\nuseful for assisting the recipient of these email messages in automatically filtering and\norganizing the submissions they receive.\n\nThis variable is required. If not specified, CGI::Application::Mailform will die() with\nappropriate errors.\n\nMAILTO\n$mf->param('MAILTO' => 'formrecipient@your.domain');\n\nThis variable specifies the email address to which the email created by this mailform should\nbe sent. This should be the email address of the person to whom the form contents should be\nemailed. This person will receive a reasonably formatted message every time this mailform is\nsubmitted.\n\nThis variable is required. If not specified, CGI::Application::Mailform will die() with\nappropriate errors.\n\nHTMLFORMREDIRECTURL\n$mf->param('HTMLFORMREDIRECTURL' => '/uri/or/url/to/mailform.html');\n\nThis variable specifies the URL (or URI) to which the web user should be redirected before\nthey have submitted the mailform. This should be the HTML form which the user fills out, the\ncontents of which will be emailed once they are submitted.\n\nThis variable is required. If not specified, CGI::Application::Mailform will die() with\nappropriate errors.\n\nSUCCESSREDIRECTURL\n$mf->param('SUCCESSREDIRECTURL' => '/uri/or/url/to/thankyou.html');\n\nThis variable specifies the URL (or URI) to which the web user should be redirected once\nthey have submitted the mailform. Typically, this would be a \"thank you\" screen which\nassures the user that their form submission has been received and processed.\n\nThis variable is required. If not specified, CGI::Application::Mailform will die() with\nappropriate errors.\n\nFORMFIELDS\n$mf->param('FORMFIELDS' => [qw/name address comments etc/]);\n\nThis variable specifies the list of HTML form fields which will be processed and sent via\nemail to the specified recipient. Only the form fields specified in this list will be put in\nthe email message which is generated by this mailform and sent to the specified recipient.\n\nThe value of this variable must be an array reference. This variable is required. If not\nspecified, CGI::Application::Mailform will die() with appropriate errors.\n\nOPTIONAL VARIABLES\n\nSMTPHOST\n$mf->param('SMTPHOST' => 'mail.your.domain');\n\nThis variable specifies the Internet host name (or IP address) of the server which provides\nSimple Mail Transfer Protocol (SMTP) services. CGI::Application::Mailform sends all mail via\nSMTP using Net::SMTP.\n\nIf SMTPHOST is unspecified, Net::SMTP will use the default host which was specified when\nNet::SMTP was installed. If CGI::Application::Mailform is unable to make an SMTP connection,\nor successfully send mail via the SMTP host, it will die() with appropriate errors.\n\nSUBJECT\n$mf->param('SUBJECT' => 'New form submission');\n\nThis variable specifies the subject line of the email message which is created by this\nmailform. The subject is useful to the mailform recipient in easily recognizing (and\npossibly filtering) form submissions.\n\nThis variable is optional. If not supplied, CGI::Application::Mailform will set the subject\nto a reasonable default.\n\nENVFIELDS\n$mf->param('ENVFIELDS'  => [qw/REMOTEADDR HTTPUSERAGENT/]);\n\nThis variable specifies the list of \"environment\" variables which will be processed and sent\nvia email to the specified recipient. Only the environment variables specified in this list\nwill be put in the email message which is generated by this mailform and sent to the\nspecified recipient.\n\nAny environment variable which is present in the CGI environment may be included. Typical\nvariables might be:\n\nAUTHTYPE\nCONTENTLENGTH\nCONTENTTYPE\nGATEWAYINTERFACE\nHTTPACCEPT\nHTTPUSERAGENT\nPATHINFO\nPATHTRANSLATED\nQUERYSTRING\nREMOTEADDR\nREMOTEHOST\nREMOTEIDENT\nREMOTEUSER\nREQUESTMETHOD\nSCRIPTNAME\nSERVERNAME\nSERVERPORT\nSERVERPROTOCOL\nSERVERSOFTWARE\n\nSee your web server documentation for a complete list and descriptions of the available\nenvironment variables. The list of environment variables specified by the CGI protocol can\nbe found at the following URL:\n\nhttp://hoohoo.ncsa.uiuc.edu/cgi/env.html\n\nThe value of this variable must be an array reference. This variable is optional. If not\nspecified, no environment variables will be included in the mailform email message.\n\nFinally, you must actually cause your Mailform to be executed by calling the run() method. Your\ninstance script 'mailform.cgi' should end with the following lines:\n\n$mf->run();\nexit(0);\n\nThese lines cause your configured Mailform ($mf) to be executed, and for the program to cleanly\nexit, respectively.\n\nNOTE: It is not necessary that your HTML file be called 'mailform.cgi'. You may name this file\nanything you like. The only naming limitations are that this file should be named so that your\nweb server recognizes it as an executable CGI, and that your 'mailform.html' file specifies your\ninstance script in the \"action\" attribute of the <form> element.\n\nAll things considered, your CGI instance script will be a very small, simple file. Unlike other\nreusable \"mailform\" scripts, the instance scripts are specifically intended to be very easy to\nwork with. Essentially, these instance scripts are \"configuration files\" for your web-based\napplication. The structure of instance scripts is a benefit of building applications based on\nthe CGI::Application framework.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "CGI::Application\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Jesse Erlbaum <jesse@erlbaum.net>\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyright (c) 2001, 2002, Jesse Erlbaum <jesse@erlbaum.net>.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}