Web Hosting Forum | Lunarpages
News: Server Migrations to San Diego: Deneb, Felix and Tsohea are moving to San Diego starting Tuesday, December 30, 2008 at 10pm Pacific. They will complete their moves Friday night, January 2, 2009

Isis, Seth and Ez-web-n-mail will move physically on Friday, January 2, 2009

Please see the forum posts at http://www.lunarforums.com/lunarpages_web_hosting_server_information-b54.0/

+ Submit Your Own Web Site for the January 2009 Site of the Month Contest!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 07, 2009, 07:14:15 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: HTML Form email handler  (Read 726 times)
geolev
Intergalactic Cowboy
*****
Offline Offline

Posts: 74


WWW
« on: February 18, 2008, 09:09:08 PM »

Hello,

Does anybody have a recommendation for a good script to handle form submissions to e-mail?

I have a simple form that when someone fills it out and clicks the Submit button, it emails the form values to my e-mail account.

Most of what I found requires sendmail. It appears that qmail is installed on my VPS. Can anybody tell me how to set something up?

Thanks,
George
Logged

perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1132



« Reply #1 on: February 19, 2008, 10:56:11 PM »

Hi George,

Qmail fully replaces sendmail and is compatible with it. Any scripts that work through sendmail binary will work on a server with Qmail smoothly.  We would recommend the FormMail script available here: http://nms-cgi.sourceforge.net
Logged

Kind Regards,
Vlad Artamonov
geolev
Intergalactic Cowboy
*****
Offline Offline

Posts: 74


WWW
« Reply #2 on: February 20, 2008, 07:35:07 AM »

Thanks, I'll give it a try.
Logged

perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1132



« Reply #3 on: February 21, 2008, 08:44:00 PM »


You're always welcome.
Logged

Kind Regards,
Vlad Artamonov
geolev
Intergalactic Cowboy
*****
Offline Offline

Posts: 74


WWW
« Reply #4 on: February 22, 2008, 05:59:40 AM »

Okay, I installed FormMail. I followed the instructions I found here http://www.lunarforums.com/lunarpages_how_tos/setting_up_nms_formmail-t18221.0.html

step-by-step.

When I submit my form, the perl script is downloaded and displayed in my browser.  Crying or Very sad I see a pattern here. Server side scripting isn't working in this domain for some reason. This is the same thing that happens when I try to access a php script. Only difference there is I am prompted to down load the file. Here it just downloads it and presents it to me.

Odd thing is, it does this only if the file extension is .cgi. If I change it to .pl I get a "Forbidden You don't have permission to access /sandbox/cgi-bin/test.pl on this server" error message.

Is it because the directory /sandbox is password protected?

Thanks,
George
Logged

perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1132



« Reply #5 on: February 23, 2008, 09:30:45 PM »


Is the sandbox folder is a subdomain or just a folder inside the domain's DocumentRoot? It looks like you don't have cgi-bin folder in sandbox configured correctly to run cgi scripts.
Logged

Kind Regards,
Vlad Artamonov
geolev
Intergalactic Cowboy
*****
Offline Offline

Posts: 74


WWW
« Reply #6 on: February 24, 2008, 09:46:49 AM »

Hi Vlad,

You are on to something. I have spent the last 8 hours playing with it and here is what I know (which ain't much)..

To answer your questions, the sandbox directory is in the httpdocs directory. It is not in a sub-domain. Presently, the sandbox directory does NOT have a cgi-bin directory. It did originally but I have removed it.

The httpdocs directory does contain a cgi-bin directory but it isn't being used as far as I can tell. I ultimately overcame my issue by putting the FormMail script in the cgi-bin directory just above the httpdocs directory:

advancedcomfortsystem/cgi-bin

My html form is in httpdocs/sandbox. This is a password protected folder so that only my client can access his new web site which is underconstruction there.

The html form action is "../cgi-bin/FormMail.cgi" (Not the real name of the cgi)

My problem was I put the FormMail.cgi script in the sandbox/cgi-bin directory and I tried everything to get it to work but couldn't. After many iterations I stumbled across the cgi-bin directory just above the httpdocs directory. I put the script in there and then tried setting the form action to "../../cgi-bin/FormMail.cgi", which made sense to me but it didn't work. I then tried "../../../cgi-bin/FormMail.cgi" and it didn't work. My final attempt of "../cgi-bin/FormMail.cgi" worked and I am happy. I don't understand why this works. Isn't that cgi-bin directory two directories up from form page in httpdocs/sandbox?

Now, what did I do wrong? Shouldn't I be able to reference the cgi-bin in the sandbox directory?

So when you say I might have my sandbox/cgi-bin directory
Logged

perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1132



« Reply #7 on: February 25, 2008, 05:16:48 AM »

Hello,

In reply to the questions you stated:

1) Why "../cgi-bin/FormMail.cgi" works. Usually, in web server configuration, the path to the virtualhost's cgi-bin folder is "/cgi-bin" in the links. The path to your test folder is "/sandbox", so "../cgi-bin/FormMail.cgi" worked in page under the sandbox folder as the correct relative path to the script in /cgi-bin because ".." means the parent folder. The ".." makes the link pointing to the first level of straight link which is / for the /sandbox and the rest of link is the correct path.

2) In order to have cgi-bin folder working under sandbox directory, please try puting in that folder .htaccess with the following content:

AddHandler cgi-script .cgi .pl
Options FollowSymLinks +ExecCGI

As another solution I would recommend setting up a subdomain for the test site. This subdomain should get its own cgi-bin folder configured.

I hope this helps.
Logged

Kind Regards,
Vlad Artamonov
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM