There is very little you need to understand about the formmail script. Primarily, you need to be certain that the path to Perl is correct. Your host should provide an FAQ or knowledge base to tell you the correct path to Perl. Typically it is going to be the default:
If it is different your host should tell you and then edit that line exactly as they indicate. You may also need to add the following line of code, depending upon your host's configuration:
So your first three lines of code would look like this:
#!/usr/bin/perl
# Perl module for HTTP REFERER Check
use LWP::UserAgent;
- #!/usr/bin/perl
- # Perl module for HTTP REFERER Check
- use LWP::UserAgent;
(*side note - you should be able to use any text editor or HTML editor to edit the perl script for formmail)
The next edit would be the $mailprog. This is the original from v 1.92 (which is the most current version you should be using):
$mailprog = '/usr/lib/sendmail -i -t';
Here's an example of how it could be changed:
$mailprog = '/usr/lib/sendmail -f youremail@yourdomain.com -t';
You may or may not need to edit that depending upon your host. I had to edit this line because of special spam filters my host has in place. Check with your host.
The next edit would be @referers. This is a security feature that prevents spammers from hacking your form. Here is the original:
Here's an example of the edit:
@referers = ('yourdomain.com','www.yourdomain.com','255.255.255.1 ');
You should include any variations of your domain.
That should be all the editing you have to do to your Perl script to make it work. (*sidenote -- some hosts require that the file extension for the script is .pl, others require .cgi -- in either case you'll need to upload the edited file to your cgi-bin)
As far as the form itself, that will be created on a separate HTML page. Here's a simple example:
<html>
<head>
<title>Form</title>
</head>
<body>
<FORM method="POST" action="/cgi-bin/formmail.pl">
<input type="hidden" name="required" value="name,email" />Your Name:
<input class="form" tabindex="1" type="text" size="30" name="name" /><br />Your Email:
<input class="form" tabindex="2" type="text" size="30" name="email" /><br />
<input class="form" tabindex="3" type="submit" value="Submit" title="Submit this form"><br />
</form>
</body>
</html>
- <html>
- <head>
- <title>Form</title>
- </head>
- <body>
- <FORM method="POST" action="/cgi-bin/formmail.pl">
- <input type="hidden" name="required" value="name,email" />Your Name:
- <input class="form" tabindex="1" type="text" size="30" name="name" /><br />Your Email:
- <input class="form" tabindex="2" type="text" size="30" name="email" /><br />
- <input class="form" tabindex="3" type="submit" value="Submit" title="Submit this form"><br />
- </form>
- </body>
- </html>
Hope that helps. Good luck.