Learn how to create a simple Web form whose results may be sent to specific UB email addresses.
This document assumes you have some familiarity with HTML forms.
Begin the form in your HTML document with a “form”
tag that is pointed at the WingsMail script:
Specify the fields and values submitted by the form. These will include things you want to define (like the email addresses the form results are sent to) and things you want the person filling out the form to provide (like his or her name, comments, and so forth).
To define values in a form yourself, use an “input” tag with the following three attributes:
Below are attributes whose values you will likely want to set, followed by an example of the HTML code.
Email Recipients [to]
This value controls which email address(es) the emailed form results are sent. Separate multiple email addresses with a comma. Only @buffalo.edu addresses may be used.
Email Subject [subject]
This value controls the subject of the email that is sent when the form is submitted.
You may want your visitor to set the subject of the email. In that case, use the following instead:
What is the subject of your question?
Name of the Form [source]
This value will appear in the email that is sent when the form is submitted. This is especially helpful if you have multiple forms on your website, and you want to be able to tell which form a particular email came from.
Address of the Web Page the Form Came From [source-url]
Similar to “source” above, this value is helpful if you have multiple forms on your website, and want to be able to tell which form a particular email came from. Instead of a form name, give the URL the form can be found at.
Don’t Allow Anonymous Submissions [anon]
If you include this code, the form will not be processed if the user doesn't specify an email address.
Thank You Page URL [return]
Once your visitor fills out your form, it is customary to direct them to a “Thank You” page, often with information about when they will hear back from you, if applicable. Once you create that Thank You page, you can give its URL here.
Thank You Text [thanks]
If you didn't use the [return] option above, you may have text displayed to your visitor after the form is submitted.
Required Fields [reqfields]
List required fields. If your visitor leaves these fields blank, he or she will receive an error message and an opportunity to supply the missing information. Separate the field names by the "|" symbol. These names must appear in your form.
Return Path [return-path]
In the event that the email created by the form cannot be delivered, this value specifies the email address that will receive the system error message (default is firstname.lastname@example.org).
From Email Address If None Specified [fromaddress]
When email gets sent to you, and no “email” value has been entered (see below), you may specify an address.
This is what we usually think of when we think of Web forms: a series of questions (or “labels”) accompanied by empty boxes for the visitor to enter information.
To create each simple text input box that your visitor may fill out, use an “input” tag with two attributes:
Below are common attributes whose values you will likely want your visitor to supply, followed by an example of the HTML code.
Visitor’s Email Address [email]
The email will show up just as if your visitor had sent it through an email program. If you click “reply” to the message, your email program will start a message to whatever email address your visitor has entered.
What's your email address?
Email Sender’s Name [fromname]
The person's real name.
What is your name?
You will probably want to add your own fields to those above. To do so, use the same format, but replace the value of “name” with a descriptive word of your own. For instance:
What is the room number?
Note: Each “name” must be unique.
3. Supply a submit button and close your form tag.
When the form is submitted, it is sent to the WingsMail script. This script uses some of the values to create the email (to, subject, and so forth) and set other options (such as what page to display after the form is submitted). The other values are placed in the body of the email. There will be a line for each input “name” and its corresponding value, separated by an “ = ” sign:
Comments = When I was about thy years, Hal, I was not an eagle’s talon in the waist. Name = Zooey Perry
By default, the form results are alphabetized by the field names. This can result in an email that is hard to read. One way to specify an order is to add a numerical prefixes to the input tags’ “name” attributes. For example, if your form has the following code:
Your email results will appear like this:
01. Name = Zooey Perry 02. Comments = When I was about thy years, Hal, I was not an eagle’s talon in the waist.
The form results email also includes information about the submission in a footer:
----------------------------------------------------------- Supplied E-Mail Address: email@example.com Sending Host: […] WWW Browser Client: […] Refering URL: […] End Of Message
This is the HTML for a sample form that asks for the name, email
address, and subject, then emails the information and redirects the
user to another page. The message is rejected if the name or email
fields are left blank. Replace _at_ in the second line below with