Form using CGI email

The script "cgiemail" in your cgi-bin allows you to receive information entered into a form by email. This script requires the following two steps:
1. Create a template of the email message to be sent.
2. Create an HTML form that fits the email template, the complete documentation about cgiemail can be found at http://web.mit.edu/wwwdev/cgiemail/user.html.

Simple Example :
The script is relatively simple to use. And the quickest way to begin using is a simple example. Here is an example template and HTML form:

Email Template :
---------------------------------------------------
To: myemailaddress@somedomain.com
From: [email]
Subject: Response Form Email

[userresponse]
---------------------------------------------------
HTML Form :
---------------------------------------------------

<.HTML>
<.HEAD>
<.TITLE>Example Form<./TITLE>
<./HEAD>
<.BODY>
<.H1>Example Form<./H1>
<.FORM METHOD="POST" ACTION="/cgi-bin/cgiemail/template.txt">
Your e-mail address: <.INPUT TYPE="text" NAME="email" SIZE="30"><.BR>
Comments: <.TEXTAREA NAME="userresponse" ROWS=3 COLS=55 WRAP="physical"><./TEXTAREA><.P>
<.INPUT TYPE="submit" VALUE="Submit Comment"><.P>
<.INPUT TYPE="reset" VALUE="Start Over">
<./FORM>
<./BODY>
<./HTML>

---------------------------------------------------
The key items to notice are:

In the template in part 1 there are two fields with brackets around them. They are [email] and [userresponse]. These are variables within the form that will be replaced with text entered in by the HTML form.
In the form there are two form fields. They are named "email" and "userresponse". Notice that they match the variables within the template.

The most complex part is getting the FORM ACTION correct. The action must start with "/cgi-bin/cgiemail/". The portion at the end is the name of the file that has the template. So in the example the template was stored in the file name "template.txt".

Kindly note that you have to place the template.txt file and the HTML Form in the same directory. If you are NOT placing both the files in the home directory, you have to give the directory name in the Form Action part of the form. So for example, if you are placing both the files in the directory called "FORM", then you have to leave the form action part as: "/cgi-bin/cgiemail/FORM/template.txt".

  • 332 Users Found This Useful
Was this answer helpful?

Related Articles

I cannot send emails

If you're having trouble sending emails on port 25 (the default SMTP port), try switching your...

Can I have my own SMTP servers ?

SMTP servers are setup by default and you would have your very own for example mail.yourdomain.com.

Can I use email catch all facility?

Yes with Catch-all you have the possibility to receive mails to the address of the domain...

Why is FROM field for non-existant domains disabled?

We have disabled sending any emails with the field 'FROM; containing non-existent domain name on...