How to Create a Contact Form using Formmail

Step 1: Download the newest copy of the Form Mail script from http://www.scriptarchive.com/download.cgi?s=formmail.
Step 2: Unzip the archive and open the FormMail.pl file using your preferred text editor (e.g. notepad).
Step 3: Edit the following settings located at the top of the file…

locate:
$mailprog = ‘/usr/lib/sendmail -i -t’;
… and replace with:
$mailprog = ‘/usr/sbin/sendmail -i -t’;
Now locate:
@referers = (‘scriptarchive.com’,’72.52.156.109′);
… and replace with:
@referers = (‘yourdomain.com’);
Note: Make sure that you replace yourdomain.com with your actual domain name.

Step 4: Using FTP, upload the saved file from step 3 to the cgi-bin for your website (normally found at public_html/cgi-bin).
Step 5: Still using FTP, change the permissions of the FormMail.pl file to allow it to be executable (e.g. 0755).
Step 6: Open the file you wish to place the contact form on and paste the following code.

<form id=”contact” name=”contact” method=”POST” action=”/cgi-bin/FormMail.pl”>
<label>Your Email: </lable><input type=text name=”email” /><br />
<label>Subject: </lable><input type=text name=”subject”/><br />
<label>Message: </lable><textarea name=”body” id=”body” cols=”45″ rows=”5″></textarea><br />
<input type=hidden name=”recipient” value=”user@yourdomain.com” />
<input type=hidden name=”redirect” value=”http://yourdomain.com/thankyou.html“/>
<input type=”submit” name=”button” id=”button” value=”Send” />
</form>

Step 7: Save the file and execute the link.

Related Articles