;

PDA

Click to See Complete Forum and Search --> : CGI Script


Darken99
04-15-2002, 01:53 PM
I am trying to get an onscreen email.... http://www.tmghosting.ca/ian/email.html

and I am not sure what all I have to do.... I am running on a winNT Server that has Perl installed on it. I am just not sure what files I have to have set up and in what directories....

If anyone could help, I will give them a cookie

Darken99
04-15-2002, 03:40 PM
I have no idea how this thing works.... I am trying to copy the code off of another site... I think he has a unix server can anyone tell me if this code is anything like what I want and why it isnt working?



# d:/perl -w
# contact webhostsolutions.ca
# webhostsolutions.ca
# 07/23/2000

# use lib
use 5;
use strict;
use CGI::Pretty;

# limit 1000K bytes post, permit upload
$CGI::POST_MAX = 1024 * 1000;
$CGI::DISABLE_UPLOADS = 0;

# initialize variables
my $cgi = new CGI;
my ($emailfrom, $subject, $message);

$emailfrom = $cgi->param("emailfrom");
$emailfrom =~ s/@/\@/;

$subject = $cgi->param("subject");
$subject = "Perl Email : " . $subject;

$message = $cgi->param("message");
$message =~ s/</&lt;/g;
$message =~ s/>/&gt;/g;

# print header
print $cgi->header,
$cgi->start_html("contact webhostsolutions.ca");

print $cgi->h2("contact webhostsolutions.cal"),
$cgi->hr(),
$cgi->br();

# print message, send email
if (($emailfrom eq "") || !($emailfrom =~ /@/)
|| ($subject eq "contact webhostsolutions.ca : ") || ($message eq ""))

{

print $cgi->h3($cgi->font({-COLOR=>"#FF0000"},
"Please go back and fill in your valid email address, subject and message."));

} else {

print $cgi->h3("Thank you for sending your email.");

open(MAIL, '| c:\exchsrvr\ -t -oi');

print MAIL <<EOF;
To: $emailto
From: $emailfrom
Subject: $subject
$message
EOF

close MAIL;

}

# print footer
print $cgi->hr(),
$cgi->a({-href=>"http://www.tmghosting.ca/ian/perl/email/email.cgi"},
"Program Source"),
$cgi->br();

print $cgi->end_html();

nucleuz
04-16-2002, 09:10 AM
What error messages does it spit out???