![]() |
ITS
Documents
|
|
Call
651-638-6500 for all computing needs at Bethel
|
||
FormMail HowtoTable of Contents
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Introduction:What is FormMail, and why should I use it?Before this script, any Bethel website-author who wanted to have a web page that gathered input and then e-mailed it to the persons interested had to ask the webmaster to create a custom cgi script for that specific form. Over time, this practice created too many forms that were all the same except for a few details. This also created an inconvenience for the website-authors, since they had to submit a request and then wait until the webmaster had time to tend to it.This FormMail script removes all of that extra overhead, and places the power of form mailing completely in the hands of the website-author. And best of all, no cgi scripting is required! Copyright Notice: This version of FormMail has been enhanced from the original open source FormMail, which can be found at Matt's Script Archive, to give even more power back to you, the website-author.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
New FeaturesE-mail the form submitter (e-mail confirmation):Bethel FormMail allows web authors to automatically send confirmation e-mails back to the submitter of the form. Security Enhancement:: Rate Limiter:In order to prevent spammers and DOS attackers from using our forms which allow e-mail
comfirmations for their own purposes,
we have developed a way to limit the number of form access by ip address. You can access FormMail
forms on our site a maximum of five times in one hour. If you exceed this limit you are blocked,
and can only submit one form per hour. After 24 hours, you will be unblocked.
This feature is only needed for a form that sends an e-mail confirmation back to the form submitter. By default, it is turned off. If you form is not located on the bethelnet, you MUST turn it on if you are going to send confirmation e-mails! You can turn it on by adding the following to your configuration file: abuselimiter=on
Templates and hidden configuration (bethelnet): Web designers can now use templates to help format the 'thank you for submitting' (e.g. form results)
html page.
The only required file is admform.html.fmc. If the results file is not found, a generic template is used.
If your form is located on the bethelnet, the FormMail you will call is: www.bethel.edu/cgi-bin/fm/FormMail2.pl. Since the templates and configuration are not on the same webserver as FormMail, it retrieves them via HTTP (which causes a slight delay). Security isn't as much of an issue on the bethelnet, since only Bethel Community Members are allowed access to it. So to try and minimize the delay, the forms' template and configuration file are located in the same web folder as the form itself. In other words:
Sometimes you want more flexibility over what is displayed on the 'thank you' page. What if you want to say something different depending on whether the user submitted a 'yes' or a 'no'? Well, now this is all possible. Using templates, you can now include form fields as javascript variables. For more information, check out the template description and the configuration parameter
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Configuring FormmailAs described above in the 'New Features' Section, the formmail configuration is now placed in the hidden '/data' directory closest to the actual form location.Configuration parameters are placed in that file, one per line, in the format of: parameter=value Actually, some configuration parameters are located in the form itself, like email. If the parameter is supposed to be specified in the form itself, the example will be in html. Otherwise, the parameter should be placed in the configuration file.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Examples
recipients=WebmasterThis is the most basic configuration you can have. It will send the form to the webmaster, and only allows web pages located in the bethel.edu domain to use it. The html thank you page will use the default 'Bethel Thanks You' html template. Here is a sample configuration file for the above form. recipients=WebmasterThe recipients of this form are the webmaster and admissions e-mail addresses. The subject of the e-mails that are send out will be 'Job Posting Request'. There are four fields that are required: employer, contact, phone, and email. Only Bethel pages are allowed to use this form. It is using the default results html and e-mail templates, and on the results html, a link back to the form is provided. In the results html and e-mails, the form field qualififications will be listed as 'qualify', and the field employer will be listed as 'Employer'. Also, a website address is allowed to be placed in the 'website' field, and the field named Submit will not be displayed.. TemplatesHow to setup a template fileThe templating options look very much like custom html server side includes. They follow the pattern: <!--%name--> and can be inserted in the results html template, and the recipient and submitter e-mails. Five template functions are supported: jsfields, titlehead, title, formresults, and date.
Use: Results html page Description: This function converts the fields specified in jsfields to javascript variables. In this way, you can develop a template that can display something different depending on what was input into the form. An example of where this could come in handy would be if you wanted to display a different page depending on whether the form submitter selected a 'yes' or 'no'. If jsfields configuration parameter is: jsfields=answer, and on the previous form, answer was two radio buttons, one with a value of 'yes', the other of 'no', then this will be what is inserted in the results html:
<script language='javascript'><!--var answer='(either yes or no)';//--></script>Here is how you could use this in your template: <script language='javascript'><!--
if (answer = 'yes') { document.write("you chose yes<br>");}
elsif (answer = 'no') { document.write("you chose no<br>");}
//--></script>
Name: titleheadUse: Results html page Description: This function prints html code for the header title of the results html page. This should be placed in the html header. The title is retrieved from the 'title' configuration parameter.
Name: title
Name: formresults
Name: date For the html template, you can also use stylesheets to customize the colors/layout of your page. The title on the page uses the class 'royal', and the cell on the left side of the table use the class 'fname', while the the right cells use the class 'value'. Html TemplateThis is a bit more involved, so you have two choices: |