Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
New to web design - need help with CGI email
Old 02-18-2011, 01:16 AM New to web design - need help with CGI email
Novice Talker

Posts: 5
Name: Greg
Location: Australia
Trades: 0
Hi everyone this is my first post here.
I'm fairly new to web design and I'm having trouble with CGI form to email.
I have installed the form which calls a .pl file which interprets and sends on the email. When I submit the form I get a 500 error plus a 404. Error logs show that the error.htm and ok.htm files aren't found. These files are on the server though. Even though I get these messages, I actually receive the email! Like I said, I'm new to this so instructions for a child would be appropriate...
If you would like to check the test emailer I have made it is www.secondnatureaquariums.com.au/test.htm
Thanks
secondnature is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-18-2011, 04:43 AM Re: New to web design - need help with CGI email
Skilled Talker

Posts: 60
Name: Dmitry
Trades: 0
You need to enable CGI support on your server. If you using VPS or dedicated server you can do it by yourself or ask support team for that.
__________________
Sincerely, Dmitry

Please login or register to view this content. Registration is FREE
ElmanF is offline
Reply With Quote
View Public Profile Visit ElmanF's homepage!
 
Old 02-18-2011, 06:36 PM Re: New to web design - need help with CGI email
Novice Talker

Posts: 5
Name: Greg
Location: Australia
Trades: 0
Thanks for the reply elfman. I just rang the host and they had no idea what I was talking about. Pretty annoying seeing as they are the host and should know. Would it help if i post the code from the .pl file?
secondnature is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 06:45 PM Re: New to web design - need help with CGI email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
These files are on the server though.
But are they in the right locations and using the correct case?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-18-2011, 07:12 PM Re: New to web design - need help with CGI email
Novice Talker

Posts: 5
Name: Greg
Location: Australia
Trades: 0
Hey chrishirst. I think so but I will triple check. The error.htm and ok.htm that the file calls - I just make those myself right? The .pl file uses relative URL's to these locations - should I use the full URL? I tried this but it made it worse. I probably got the Perl syntax wrong though.
secondnature is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 07:27 PM Re: New to web design - need help with CGI email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
The error.htm and ok.htm that the file calls - I just make those myself right?
More than likely, probably just to display appropriate messages to the user.

Quote:
The .pl file uses relative URL's to these locations - should I use the full URL?
No idea, however using root relative URIs is often more reliable than document relative ones.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-18-2011, 07:39 PM Re: New to web design - need help with CGI email
Novice Talker

Posts: 5
Name: Greg
Location: Australia
Trades: 0
Can i send you the file or post some of its code here? It sounds like you'll know what the problem is straight away.
secondnature is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 07:41 PM Re: New to web design - need help with CGI email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
post the code
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-18-2011, 08:10 PM Re: New to web design - need help with CGI email
Novice Talker

Posts: 5
Name: Greg
Location: Australia
Trades: 0
this is the entire .pl file


Code:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
print "Content-type: text/html \n\n";
# Website Contact Form Generator 
# http://www.tele-pro.co.uk/scripts/contact_form/ 
# This script is free to use as long as you  
# retain the credit link  
# get posted data into local variables
$input = new CGI;
$EmailFrom = $input->param('EmailFrom'); 
$EmailTo = "greg\@secondnatureaquariums.com.au";
$Subject = "Aquarium question";
$Name = $input->param('Name'); 
$Tel = $input->param('Tel'); 
$EnteryourQuestion = $input->param('EnteryourQuestion'); 
# validation
$validationOK=true;
if ($EmailFrom eq '') {$validationOK=false;}
if ($Tel eq '') {$validationOK=false;}
if ($Tel !~ /^[0-9|.|,]*$/) {$validationOK=false;}
if ($EnteryourQuestion eq '') {$validationOK=false;}
if ($validationOK eq false) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}
# prepare email body text
$Body .= "Name: ";
$Body .= "$Name";
$Body .= "\n";
$Body .= "Tel: ";
$Body .= "$Tel";
$Body .= "\n";
$Body .= "EnteryourQuestion: ";
$Body .= "$EnteryourQuestion";
$Body .= "\n";
# send email 
$mailprog = '/usr/sbin/sendmail -t';
open(MAIL,"|$mailprog");
print MAIL "To: $EmailTo\n";
print MAIL "From: $EmailFrom\n";
print MAIL "Subject: $Subject\n\n";
print MAIL $Body;
close(MAIL);
# redirect to success page 
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";

Last edited by chrishirst; 02-24-2011 at 05:10 PM..
secondnature is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to New to web design - need help with CGI email
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57599 seconds with 12 queries