Gossamer Forum
Home : Gossamer Threads Inc. : Discussion :

Perl Problem...

Quote Reply
Perl Problem...
I am trying to create a feedback form for my visitors and have created the html page with the correct fields and field names and the form is posted to a file called form.pl

This is the code I have in form.pl...

#!/usr/bin/perl

use CGI;
$cgi = new CGI;

$admin = "paul\@audio-grabber.com";
$mailprog = "/usr/sbin/perl";

$name = $cgi->param("requiredName");
$age = $cgi->param("requiredAge");
$email = $cgi->param("requiredEmail");
$country = $cgi->param("requiredCountry");
$comments = $cgi->param("requiredComments");

print $cgi->header."

<b><i>Message Sent!</i></b><BR>
<BR><small>You supplied the following information:

<table><TR><TD><small>Name:</td> <TD><small>$name</td></tr>
<TR><TD><small>Age:</td> <TD><small>$age</td></tr>
<TR><TD><small>Email:</td> <TD><small>$email</td></tr>
<TR><TD><small>Country:</td> <TD><small>$country</td></tr>
<TR><TD><small>Comments:</td> <TD><small>$comments</td></tr></table>
<p>A reply will be given asap if necessary!</small>
";


sub send_mail {
open(MAIL,"|$mailprog -t");

print MAIL "To: $admin\n";
print MAIL "From: $email\n";
print MAIL "Subject: Audio-Grabber Feedback\n\n" }
print MAIL "Below is the result of your feedback form. It was submitted by $name\n";
print MAIL "Results are below:\n";
print MAIL "$name\n";
print MAIL "$age\n";
print MAIL "$email\n";
print MAIL "$country\n";
print MAIL "$comments\n";


Wherever I seem to call &send_email; I get an internal server error. How do I send the actual email?

What am I doing wrong?

Do I need the backslash here too?
$admin = "paul\@audio-grabber.com";

Thanks!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Perl Problem... In reply to
In Reply To:
$mailprog = "/usr/sbin/perl";
This should be pointing to sendmail - not perl.
$mailprog = "/usr/sbin/sendmail";

easy does it
Quote Reply
Re: Perl Problem... In reply to
Ooops...yes....cant believe I wrote perl!....lol

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Perl Problem... In reply to
Hmm.....Im still getting an internal server error.

As soon as I remove &send_email; the error goes.

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Perl Problem... In reply to
It looks like you have put

print MAIL "Subject: Audio-Grabber Feedback\n\n" }

insted of

print MAIL "Subject: Audio-Grabber Feedback\n\n";

Andy

Quote Reply
Re: Perl Problem... In reply to
Oh thanks....

So if I put &send_email; above print print $cgi->header." should it work now?

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Perl Problem... In reply to
Yes,you need to call it via

&send_email;

You can put it just before the sub routine really would be best.....

A.J.Newby
webmaster@ace-installer.com
http://www.ace-installer.com

Quote Reply
Re: Perl Problem... In reply to
Thanks but Ive rewritten a big chunk of the code and got it working now!

It sends an email to the customer as well as admin too, and writes the info to a file!



Paul Wilson. Shocked
(Dont blame me if I'm wrong!)