Webpage emailing form

  joelmb 02:27 01 Mar 2004

Hi. Ive got a very simple two field form on my contact page which I want to have sent to me when the website user clicks submit.

I know this is always a mine-field, getting cgi scripts to work etc etc. I'm currently struggling with matts script archive's send mail but getting the notrorious "CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers."

Anyone know of an easier way, or an extension for Dreamweaver to simply do this? Or otherwise what I should check is wrong with my sendmail script?

  Taran 09:24 01 Mar 2004

There are several Dreamweaver extensions that offer email handling [of a sort] that I know of.

Examples are NeXTensio2 combined with PHAkt2 which rely on using server behaviours [PHP, ASP, ColdFusion etc] while others are basic, pre-built PHP forms. A quick search on the Macromedia Exchange for the word email in the Dreamweaver section will return a few possibilities. Most of them cost though.

To get your FormMail script to work properly at a basic level you need to include these fields in your form:

<form name="form1" method="post" action="/cgi-bin/FormMail.pl">

<input type="hidden" name="subject" value="Title of the email subject" />

<input type="hidden" name="redirect" value="Full URL including http of the 'thank you for contacting us' page" />

<input type="hidden" name="recipient" value="email address of the recipient" />

The first section is obviously the location of the FormMail.pl script on your web server. The second assigns a subject to all emails sent from the form, the thrid redirects people who submit the form to a 'Thank you' page and the fourth should contain the email address of the person to receive the emails.

The FormMail.pl script itself needs minimal adjustments in most cases for basic operation. Make sure the first line in the FormMail script is correct - get this information from your web host:


The next uncommented line is the address of your email program script on the server - again, get this information from your web host, but it is normally:

$mailprog = '/usr/sbin/sendmail -oi -t';

Next you should alter the @referers line as follows:

@referers = ('your site URL without www','your site URL with www','you can use localhost as well if required');

Note that the referers list is in this form (',',') and that missing out the brackets of single quote marks will make it all fall over.

Finally all you need to do is edit the @recipients line as follows:

@recipients = &fill_recipients('your site URL without the www','again you can leave localhost in if required');

Make sure you have both the cgi-bin folder and the FormMail script chmod to 775 or to -rwxr-xr-x if you use WS_FTP Pro and make sure any editing of the FormMail script is done using a simple text editor like Notepad. Word processors mess up FormMail scripts like you wouldn't believe.

I'd suggest that you remove the existing FormMail script and try it again by modifying your original as I've outlined above. Include the form fields and just do the FormMail modifications I've listed, upload, chmod and see what happens.

Most errors with FormMail are either down to incorrect chmod settings or incorrect configuration in the script itself.

Post back with the results.

  Taran 09:36 01 Mar 2004

If wrestling with Perl and an unruly cgi-bin is getting you nowhere and your host supports PHP you could try Jack's Script, an excellent PHP form handler:

click here

Some alternatives can be found here for PHP

click here

or here for CGI

click here

  Talented Monkey 12:45 01 Mar 2004

If you have PHP and its mail command available on your hosting, it is very simple to hand code your own form processing page. You will literally only need a few line of code, depending on how much info you want to send. The function you will be using is Mail() in example below you can change everything in between double quotes (speech marks) separated by a coma

mail(" destination email address "," email subject field ", "email message" ,"from field");

To make things tidier you can just use strings, you can use a mixture of both, but certainly you should use a string for message part of your email at least. The message can be any size you like as long as you remember to start it with a double quote and end it with one followed by semi colon “ message body”

mail( $send_to, $subject, $message, $from);

To keep things simple particularly if you are using things like dreamweaver and front Page and do not want to mess around adding php to it, have the form details sent to a process page in php then redirect to your thank you page in html
So form -> php process -> thank you page.

Here is a example obtraining someones name and date of birth.


<form method="post" action="process.php">
name : <input type=”text” name=”members_name”>
date of birth: <input type=”text” name=”dob”>
<input type=”submit” name=”submit” value=”submit”>


when submitted this will send the values in dob and members_name to process.php you can use these values in process.php by simply adding a $ symbol in front of them as shown when we create our message string. The only parts you need to change is between the double quotes to the required values and email address.

Finally we can use header() to go to a thank you page in html when email is sent.



$send_to = “your email”;
$subject =”email subject”;
$from =” email from”;

$message=” Members name : $members_name
Date of Birth : $dob “;

mail( $send_to, $subject, $message, $from);

header("location:click here .yoursite/thank page");


  joelmb 13:16 01 Mar 2004

Fabulous! Thank you guys. I used the phpnovice script click here in the end in case anyone else needs a VERY simple solution to what was causing me hours of wasted time messing with perl and asp solutions. :)

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5T review: Hands-on

Illustrator Andrés Lozano on his improv line work, brazen use of colours & hand sketching

iPhone X review

Comment envoyer gratuitement des gros fichiers ?