Form Mail Instructions
Note: Just added a new feature, writing to a file also: Click here for information on writing a file also.
Note: I just added a new feature, uploading files and emailing them, gif, jpeg, MSword, MSExcel, etc. Click here for information on UPLOADING FILES
This program was written by Kirk Moore for CU Colorado Springs Information Technology in Oct 2000. The program takes a form and emails the values to a users email account.
The program is simple but some knowledge of HTML would be helpful.
The program uses fields which tells it what to do. Here is a list of field names:
- To: = This field tells the program where to send the email message to. You can put other words around it, but you must make sure "to:" appears in the name.
- From: = This field tells the program who the message is from. If you place the field in the form it will replace the From line on the email message with this value.
- _confirm = This field tells the program if you want it to send back a confirm page. If so set this value to "yes", if not set the value to "no" or leave the line <input name="_confirm" value="yes"> off the form.
{NOTE: You can not use confirm if want to use the file upload.}
- _confirm_header = If you set the field _confirm to yes then the value in this field will be displayed back to the user before the information they entered is displayed. Use HTML tags, the program will put in <html> so start from there.
- _confirm_footer = If you set the field _confirm to yes then this field will dispaly the value back to the user after the their information is displayed. Use HTML tags in this field also. The program will put in <html> at the bottom.
- _thanksurl = The program will send back a page saying thank you. Put in the url of the page you want to be displayed or the program will display a general page.
- UPLOAD_FILE = If you want to upload files, gifs, jpeg, msword, etc files use this. The syntax is <input type="file" name="FILE_UPLOAD"> make sure to use the name="FILE_UPLOAD" in uppercase. This will let the user search on thier hard drive and copy a file to the server which will then be put into mime and emailed with the rest of the message.
{NOTE: You can not use the confirm function when uploading files.}
Goto the page the UPLOAD PAGE for more information. You must add the field enctype=multipart/form-data to the <:form line. VERY IMPORTANT!
Field names, the program is using the following format for field names:
- If the field name starts with an underscore then it is a system field and only the system will use the field. The user or your email message will not contain this information either. For example: _confirm, _confirm_header, _confirm_footer are system fields.
- If the field name ends with an underscore then the field is hidden to the user. Use these fields to put in information into the form that you do not want the user to see. Like the field To: is the address to send the message to, but you do not want the user to see it then make it To:_.
- You can use anything for a field name except the system ones and remember placing an underscore at the end will hide it from the user. DO NOT USE " double quotes in the name field.
- The submit button must be the last field. The program takes out the last field.
That is about all, just create a web page with a form inside which will contain the following information:
FORM STARTS HERE:
<FORM METHOD="POST" NAME="formmail" ACTION="/cgi-formmail/fm.pl">
Do not change this line unless you know what you are doing.
<input type=hidden name="To:_" value="address_to_send@some.domain">
<input type=hidden name="Subject:_" value="Place the subject line which you want to see when you receive the email message">
<input type=hidden name="_thanksurl" value="/~formmail/thanks.html">
<input type=hidden name="_confirm" value="yes">
Value can be yes, no or leave out this line. Setting the value to yes makes the program send back a confirm page telling the user to make sure their info is correct.
<input type=hidden name="_confirm_header" value="<head><title> Confirm Information </title<>/head<>body<>center<>h2>Place in text that you want the user to see about the confirm page before the values are displayed.</h2>">
Place in the information that the user will see when the page is display back to them. Use HTML codes, the header will go first then the values then the footer.
<input type=hidden name="_confirm_footer" value="Place in text for the footer here</center></body>">
Place in text that you want the user to see after the values have been displayed.
Email name of user: <input type=text name="From:">
If the program finds the field From: it will replace the from with the email address instead of the mail coming from "anonymous NFS user"
Your fields:
Your field names can contain spaces, just make sure they are inside of quotes "".
Your text for field1 <input type=text name="field1">
Your text for field number 2<input type=text name="field number 2">
Your text for field # 3: <input type=text name="field # 3">
Submit and Reset Buttons
<INPUT TYPE="submit" NAME="BUTTON" VALUE="Send Form">
<INPUT TYPE="reset" VALUE="Reset" Form">
</FORM>
That's it.
You can try it out using this form to see how it works:
Hope this works
This program written by Kirk Moore for CU Colorado Springs Information Technology