View Full Version : FormMail.cgi or FormMail.pl

June 20th, 2011, 04:49 PM
FormMail comes preinstalled on our cPanel servers.

FormMail is a script that will email you the form input from any form that you use it with. To use it you need to the use the following fields on your form:

<form action="/cgi-sys/formmail.cgi" method="post">
<input type=hidden name="recipient" value="[email protected]">

Note: You could add multiple recipients, separated by a comma. The recipient has to be an email address that belongs to your domain.

The optional forms fields you could use are:
email (from email address)
realname (used with the from email address)
redirect (redirect user to a page after submission)

An complete form example would look like this:

<form action="/cgi-sys/formmail.cgi" method="post">
<input type="hidden" name="recipient" value="[email protected]">
<input type="hidden" name="subject" value="Form Submission Results">
<input type="hidden" name="redirect" value="thank_you_page.html">

Name: <input type="text" name="name"><br />
Email: <input type="text" name="email"><br />
Comment: <br /><textarea name="comment"></textarea><br />
<input type="submit">

If you get this error:

Sorry I can't send to [email protected] Is [email protected] on this server?

On a cPanel system, you could only use an email address that is from your domain. If you want to use FormMail for an email address from another domain, then you'll have to download a FormMail.pl script from: http://www.scriptarchive.com/download.cgi?s=formmail&c=zip, unzip it and place it in your cgi-bin directory.

Then edit FormMail.pl, and find the section for that defines:
Add the domain for the email address you would like to use for the recipient.

An example would look like this:

@referers = ('scriptarchive.com','', 'www.your_domain.com', 'your_domain.com', 'gmail.com','other_domain.com');

This would allow to use email address from those hosts.

The last thing you need to do is change your form action to "cgi-bin/FormMail.pl".

Max M.