thevenerablez
Technical User
Hi,
I am new to PERL coding and I am stuck on my first CGI script. I am trying to make an email form work. Here is my script:
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard';
my ($to, $from, $name, $subject, $contents);
print "Content-type:text/html\n\n";
$to = param('to');
$from = param('from');
$name = param('name');
$subject = param('subject');
$contents = param('contents');
open(MAIL, "|usr/sbin/sendmail -t") || Error ('open', 'mail program');
print MAIL "To: $to \nFrom: $from\nName: $name\n";
print MAIL "Subject: $subject\n";
print MAIL "$contents\n",
close (MAIL);
print "Thanks for your comments.";
sub Error {
print "The server cannot $_[0] the $_[1]: $! \n";
exit;
}
If anyone could give me any pointers, I would greatly appreciate it. If you need the HTML source, I can post that too.
Thanks,
_zach
I am new to PERL coding and I am stuck on my first CGI script. I am trying to make an email form work. Here is my script:
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard';
my ($to, $from, $name, $subject, $contents);
print "Content-type:text/html\n\n";
$to = param('to');
$from = param('from');
$name = param('name');
$subject = param('subject');
$contents = param('contents');
open(MAIL, "|usr/sbin/sendmail -t") || Error ('open', 'mail program');
print MAIL "To: $to \nFrom: $from\nName: $name\n";
print MAIL "Subject: $subject\n";
print MAIL "$contents\n",
close (MAIL);
print "Thanks for your comments.";
sub Error {
print "The server cannot $_[0] the $_[1]: $! \n";
exit;
}
If anyone could give me any pointers, I would greatly appreciate it. If you need the HTML source, I can post that too.
Thanks,
_zach