PDA

View Full Version : FormMail.pl


mwoodxray
01-28-2003, 02:55 PM
OK, I've been fighting this for over a week. I give up! HELP!!!
Trying to use formmail.pl. Copied it to public_html/cgi-bin. I changed only the following:
!/usr/bin/perl
$mailprog = '/usr/sbin/sendmail -i -t';
@referers = ('mountainxray.com,216.120.236.154');
@recipients = ('^mitch\@mountainxray\.com);

I have a very simple form at public_html/simpleform.htm.
It is as follows:

<html>

<head>
<title>Simple Form</title>
<meta name="generator" content="Namo WebEditor v4.0">
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p>Simple Form</p>
<form name="form1" method="post" action="cgi-bin/FormMail.pl">
<input type=hidden name="recipient" value="mitch@mountainxray.com">
<input type=hidden name="redirect" value="http://www.mountainxray.com/Thankyou.htm">
<p>Name:<input type="text" value="Name" maxlength="20" size="20"></p>
<p>Time of test: &nbsp;<input type="text" value="Time" maxlength="4" size="4"></p>
<p><input type="submit" value="SUBMIT"></p>
</form>
<p>&nbsp;</p>
</body>

</html>

If I run it at cgi-sys, it works somewhat,(I get redirected and the email I get shows only where I was redirected to) but at public_html/cgi-bin/FormMail.pl I get this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mountainxray.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.27 Server at www.mountainxray.com Port 80

I checked the error log and the only thing I see is pointing to a permissions error from earlier today and not have it set to 755.

Mikey
01-28-2003, 03:52 PM
I had this problem as well. Try changing the permissions of FormMail.pl to 755. Usually can be done in an ftp client. Just right click the file and look for properties or something similar.

don5408
01-28-2003, 03:54 PM
Hi. You have at least two separate things going on here. I'm not sure what the problem is with the formmail script you uploaded to cgi-bin (did you make sure to upload the file in ASCII mode?) however the problem you were encountering using the script HR has in cgi-sys is due to some syntax errors in your form tags.

In the text entry fields you are using "value" where you want to use "name". With text input fields you assign a name to the field and the value is whatever the user types into the field (this is also the reason that you see the text "Name" and "Time" already entered into those fields on your form).

Try using this simpleform.htm file, this should do what you are looking to do here:

<html>

<head>
<title>Simple Form</title>
<meta name="generator" content="Namo WebEditor v4.0">
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p>Simple Form</p>
<form name="form1" method="post" action="/cgi-sys/FormMail.pl">
<input type=hidden name="recipient" value="mitch@mountainxray.com">
<input type=hidden name="redirect" value="http://www.mountainxray.com/Thankyou.htm">
<p>Name:<input type="text" name="Name" maxlength="20" size="20"></p>
<p>Time of test: <input type="text" name="Time" maxlength="4" size="4"></p>
<p><input type="submit" value="SUBMIT"></p>
</form>
<p> </p>
</body>

</html>

Hope that helps!
Don

mwoodxray
01-28-2003, 04:38 PM
Very good! That works using FormMail at cgi-sys but I still get the error when trying to use the FormMail I have at public_html/cgi-bin. Is there any way to get a copy of what is at cgi-sys for comparison?

don5408
01-28-2003, 06:29 PM
"That works using FormMail at cgi-sys but I still get the error when trying to use the FormMail I have at public_html/cgi-bin."

That's correct...as I said you clearly have (or had) more than one problem here (the problem using HR's script was a result of the syntax errors in your form, the problem with using the FormMail script you uploaded to your account seems to be with the script itself).

Offhand I really can't think of a practical reason not to simply use the confirmed as working FormMail.pl HR already has uploaded for you however if you prefer to continue to work on getting your own local copy to work I'd suggest doing this:

- Delete the existing FormMail.pl file in your cgi-bin folder
- Start with a fresh 'virgin' copy of FormMail.pl version 1.92 (http://www.scriptarchive.com/formmail.html)
- Open it in NotePad or similar basic text editor
- Change the @referers variable (only)* as follows:

@referers = ('mountainxray.com','216.120.236.154');

- Save the file
- Upload the file to your cgi-bin folder in ASCII mode
- Change the permissions (CHMOD) to 755
- Change /cgi-sys/FormMail.pl to /cgi-bin/FormMail.pl in your form
- Test the script

* Note: If you have a strong need to limit possible recipients
to mitch@mountainxray.com rather than the default in which any
@mountainxray.com addy can be used you can optionally modify
the @recipients variable as you have it above, the 'only' is
strictly in an effort to keep things as simple as possible

Best wishes
Don

mwoodxray
01-28-2003, 08:44 PM
Tried that and still get a 500 error with no help from the error log. I'm going to use the formmail.pl at the cgi-sys.

Thanks Don, you've been a lot of help.
Thanks,
Mitch

don5408
01-29-2003, 02:04 AM
"I'm going to use the formmail.pl at the cgi-sys"

Sounds like a plan...under the circumstances that's certainly be the path of least resistance.

"Thanks Don, you've been a lot of help"

You're welcome, enjoy!

Don