| |
| |
| |
| |
| |
Tutorials - CGIEmail
This tutorial will teach you how to use the CGIEmail script that is pre-installed with your hosting accout.
What is CGIEmail?
CGIEmail is a form mailing script, similar in function to Matt Wright's
formmail.pl, but it uses a text based email template instead of just sending
an email with a list of form variables.
Where is CGIEmail located?
http://www.yourdomain.com/cgi-sys/cgiemail
1.) Creating
the HTML Form
2.) Creating the Email Template
3.) Testing your form.
4.) Extra features
Create a simple html form in your favorite html editor. Something similar to this one:
First Name:
Last Name
Email:
HTML Source:
<FORM action="/cgi-sys/cgiemail/myform.txt" METHOD="post"> |
Save the html form. For this tutorial, we will save it as form.html.
Notice we chose the name of the email template to be myform.txt. You can name it whatever you wish (note: do not name it email.txt! it won't work). The path of the form action="" should be /cgi-sys/cgiemail plus the path to your email template file. In this case, our email template file, myform.txt, is located in the same place as our html form. But if it were located in say a subfolder named foobar, then the form action="" would look like this:
<FORM action="/cgi-sys/cgiemail/foobar/myform.txt"
METHOD="post"> |
2.)
Creating the Email Template
The Email template is just a regular plan text file. You can name it pretty much whatever you want, except "email.txt" . The first couple of lines must include the following information:
From: |
To use the data submitted in the form, place the form field name inside []. We will name our template myform.txt for the purpose of this tutorial. So our email template will look like this:
From: [emailaddress] |
Now save the myform.txt and form.html.
Now that we have our html page, and our
email template, we just need to upload it to our website and test it.
When you submit a form, you should see a page that shows the email that
will be sent to the recipient.
Here are some extra features that cgiemail supports:
Required Form Fields
Prepend required- to the name of the form field
in both your html form, and the email template and it will force the user
to enter a value for that field. Your code should look something like
this:
<INPUT TYPE="text" NAME="required-firstname"> |
Hi, my name is [required-firstname] |
Submission Success Page
You can have the user directed to a html
page of your choice after they submit the form, instead of being taken
to a page showing the email. To do this, put the following code in your
html form page.
<INPUT TYPE="hidden" NAME="success"
VALUE="http://www.domain.com/somepage.html">
|