Forum Moderators: coopster & phranque

Message Too Old, No Replies

how to get a form to talk to formmail and work?

need help!

         

Helena

9:35 pm on Feb 21, 2003 (gmt 0)

10+ Year Member



Hi,

I want to have a form on my site and to try it out Ive created a little testform. I really dont know much about these things but Ive tried my best and it simply wont work. Im not sure if Ive installed formmail (ver 1.92) wrong or if its the form itself.

Formmail:
I downloaded it and opened the file in wordpad. First I checked the #!/usr/bin/perl at the top and that is what it is supposed to be. Then I changed the $mailprog = '/usr/lib/sendmail -i -t'; into $mailprog = '/usr/sbin/sendmail -i -t';. And last, I changed the @referers into @referers = ('my domain-name without www','my sites IP');. Then I copied it to my cgi-bin and chmoded it 755. Is this the correct way to install formmail?

The form:
To try to get the form to talk to formmail Ive done this:
<FORM action="http://www.my website dot ext/cgi-bin/formmail.pl" method="post" name="letter">. Is this correct? Do I need anything else?

I really do need help

Helena

jatar_k

12:30 am on Feb 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It looks like you checked all the right things.

What exactly happens when you submit the form? Are there any error messages?

amznVibe

12:36 am on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



by the way, once you get it working, do yourself a favor and rename the cgi to anything but formmail,
or you will get constant hacking attempts daily...

Helena

7:01 am on Feb 22, 2003 (gmt 0)

10+ Year Member



Well, Ive gotten a little bit further now then when I wrote my last message. Then I got a long cgi-script error message now I get this:

"Bad Referrer - Access Denied
The form attempting to use FormMail resides at http: //www dot my domain name dot ext/test, which is not allowed to access this cgi script.
If you are attempting to configure FormMail to run with this form, you need to add the following to @referers, explained in detail in the README file.

Add 'www.dot my domain name dot ext' to your @referers array."

This I have done! Ive tried both with and without www, Ive also tried my domain name dot ext /cgi-bin

This does my head in....

digitalghost

7:07 am on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By any chance were you asked to set permissions on your CGI/DIR to 777?

Helena

7:26 am on Feb 22, 2003 (gmt 0)

10+ Year Member



Ive chmoded the formmailrenamed.pl to 755... Ive heard nothing about 777, is there something I should chmod 777?

digitalghost

7:29 am on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>is there something I should chmod 777?

No, just checking. Many hosts won't allow access to a CGI/Dir that has been set to 777 and some odd errors show up if the CGI/Dir has been CHMOD'ed to 777.

jatar_k

5:01 pm on Feb 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The form attempting to use FormMail resides at http: //www dot my domain name dot ext/test, which is not allowed to access this cgi script.

have you tried adding the exact url from the error message? The full url to the form added to the the @referers array?

ie
http: //www dot my domain name dot ext/test

LaurenceMartin

5:15 pm on Feb 22, 2003 (gmt 0)

10+ Year Member



Just a thought...
My first attempt with a script was formail (shiny! fun!). You might not to edit in MS Wordpad unless you spefically tell it to save in text format. It makes scripts choke otherwise. Been there, done that, got laughed at. hehe.

amznVibe

6:40 pm on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would guess there is a typo in your refers array, sticky mail me the full line or compare it closely with my working one:

@referers = ('example.com','192.0.34.166');

oh also make sure you have something further down like

@recipients = (&fill_recipients(@referers),'^yourname\@example\.com');

MWpro

6:07 am on Feb 23, 2003 (gmt 0)

10+ Year Member



I tried using the cgi formmail script once, but it was too frustrating... If you are interested in learning how to make your own php form processing script, send me a sticky and I can send you the basics. To me, making one with php is much more efficents, as there is less coding and you can actually see what things in the script do what.

Helena

8:04 pm on Feb 23, 2003 (gmt 0)

10+ Year Member



I have tried "http: //www dot my domain name dot ext/test" and every possible combination I can think of but nothing works. I have checked for typos and Ive done everything over again using notepad.... :(

Surfing my hosts webpage for information I found this though:
"What is the path to my web site, www directory?
/home/sites/yoursitenumber/web". Maybe this is what I have to use. I have no idea what my site number is though, so I will have to write to them. If that doesnt work I think Ill try php instead.

Thankyou very much for all your help and good advice, I really appreciate it :)

Helena

amznVibe

8:27 pm on Feb 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, its not a path problem to executing the cgi, because the cgi IS executing - you are getting an error message from it!

Important rules when debugging are 1. don't get fustrated easily 2. pay attention to error messages

Sticky-mail me your actual URL if you wish, so I can try to help futher and see what the URL resolves to vs. what you might think it is. If you are on a shared server there might be some minor issues with the way the domain is resolved. Setting up formmail should take minutes, not days. Sorry you are having so much trouble.

As an alternative, you might want to try the NMS flavor of formmail, which is also secure and is just a variation of the original formmail code: [prdownloads.sourceforge.net...]

amznVibe

10:17 pm on Feb 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think the answer is so simple we are over-analyzing the problem.
Since I have seen the test page, I notice you have no recipient setup!

[scriptarchive.com...]

Necessary Form Fields

There is only one form field that you must have in your form, for FormMail to work correctly. This is the recipient field.

Syntax: <input type=hidden name="recipient" value="email@your.host.com">

Now something extra I do to slow down spammers, is I don't actually use that field in my HTML, and just patch the formmail cgi. Search for the line that starts with %Config = ('recipient','' and make it say instead
%Config = ('recipient','youremail@yourdomain.com'

Then your test page should work even without a recipient field (as it is now).