Webpipe Internet Solutions
  Webpipe Internet Services   Webpipe Internet Services   Webpipe Internet Services   Webpipe Internet Services   Webpipe Internet Services
Home Company Info Internet Service Hosting Services Support
Discussion and support Forums   Website Hosting   Wireless, DSL, and Dial-up internet access   Affiliate Login

Formmail.pl howto

From Webpipe Wiki

FormMail.pl is a quick and easy to use script that can e-mail you a form submitted on your website. It's available for download at Script Archive. The script is pretty widely used and is very stable. It's compatible with any of Webpipe's hosting packages.

Here are the quick instructions for getting FormMail working on your site:

Edit the script

Download the script from the link above, and extract it onto your computer. Open the FormMail.pl in a text editor. The only line that you need to modify in the actual FormMail.pl script is the line that currently says:

@referers = ('scriptarchive.com','209.196.21.3');

You should change "scriptarchive.com" to your domain name, and remove the second value so that it looks like this:

@referers = ('yourdomain.com');

This line specifies where emails are able to sent to with the form. It is a security measure to prevent other people from sending out spam from your FormMail script. In the example above, the only email address that will be permitted to receive mail from this script are email address that end in 'yourdomain.com'

Save that file and upload it into your website's cgi-bin directory. Set the permissions on it to "755" (rwxr-xr-x).

Create your form

Now create a standard HTML form. Inside the <form> tag, set the action to the FormMail.pl script like this:

<form action="/cgi-bin/FormMail.pl" method="POST">

Now add appropriated hidden form fields that specifiy what the script is supposed to do with the form. The only REQUIRED field is the "recepient" field. Use something like:

<input type="hidden" name="recepient" value="you@yourdomain.com" />

You can also add a number of optional fields. The following are some commonly used ones:

subject: Specifiy the subject of the email
redirect Redirect to the specified URL after the email has been sent
required Specifiy which fields are required
Other Fields See http://www.scriptarchive.com/readme/formmail.html#form_config for a complete list


Now you can add all of the input variables that you want your visitors to enter. You can use Text input fields like this:

<input type="text" name="firstname" />

And you can add Drop-down boxes like this:

<select name="State">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
</select>

And you can add radio buttons like this:

<input type="Radio" name="gender" value="Male" />Male
<input type="radio" name="gender" value="Female" />Female



Troubleshooting

If you receive an "Internal Server Error", here are some things that you can check. If you have access to your log files (Webpipe customers do inside your website's "logs" directory), you can look at the last few lines of your "error_log" file to help you determine the cause. Here is a few things to verify:

  • Make sure you didn't remove an extra quote or parenthesis somewhere. The script has to have a correct syntax in order to run.
  • Make sure the script is executable
  • Make sure that you didn't upload the file in a windows text file format. If you are running the script on a Linux-based server (most are), then the newline characters should be Unix newlines. Look for a "Save as" option in your text edit and save as a Unix file before uploading
Views