K
Khnum
Hello, I am very new to Programming. I am even newer to programming
with CGI/Perl. I just recently finished a class teaching us the
beginner stuff. I thought I was doing well.
I used the Autoresponse Form Program that was given to us as a learning
tool. I edited it and used it on a practice site that I use to test new
programs. When I tried to transfer that same program to the website I
am developing for my office it just stopped working. My web host (who
is a very busy friend told me to check the code. I did that line by
line and ran it again, but to no avail. I receive no error messages.
The program runs and returns me to the thank you for submitting.....
page, but dosen't send out an email. It should send me and email and
send a response email to the person who filled out the form.
I know this is probably very basic for you guys, but can anyone help
me. I thnank you in advance.
I have include the code below:
#!/usr/local/bin/perl
#run subroutine to turn stdin into an array named %in
require "cgi-lib.pl";
&ReadParse;
#store location of mail program in variable
#your mail program's locale may differ
$mailprog = '/usr/sbin/sendmail';
#use cgi-lib.pl subroutine to set content type
print &PrintHeader;
unless (-e $mailprog)
{
print <<"PrintTag";
<HTML><BODY>
<H3>Cannot find $mailprog.</H3>
<P>There is a typo in the mail program path.</P>
</BODY></HTML>
PrintTag
exit(0);
}
#create confirmation web page
print <<"PrintTag";
<HTML><HEAD>
<TITLE>Thanks submitting your Sign request!</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<H2>Thank You! $in{'Name'}</H2>
<P>Your Sign request has been received.</P>
<P>We will be ordering your Sign immediately.</P>
<!-- change the URL below to YOUR home page -->
<a href="http://www.commercialcondominium.com">Home</a>
</body></html>
PrintTag
#open mail program
open (MAIL, "|$mailprog -t") ||
die "Can't open mail program\n";
#print message headers (to, from, subject, etc)
print MAIL "To: $in{'Email'}\n";
print MAIL "Reply-To: $in{'empmail'}\n";
print MAIL "From: $in{'empmail'}\n";
print MAIL "Subject: Your Sign request.\n\n";
#print body of message
print MAIL << "PrintTag";
Dear $in{'Name'}:
Thank you for your Sign order.
This e-mail confirms that we have received your Sign request.
We will be ordering your Sign immediately!
Sincerely yours,
Kevin Bailey
CCMC
PrintTag
#close mail program, releasing message to be sent
close(MAIL);
#open mail program for a second message to employee
open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";
#print message headers
print MAIL "To: $in{'empmail'}\n";
print MAIL "Reply-To: $in{'Email'}\n";
print MAIL "From: $in{'Email'}\n";
print MAIL "Subject: Sign request.\n\n";
#create body of message
print MAIL << "PrintTag";
Please place Sign order for:
$in{'PropertyName'}
$in{'Name'}
$in{'BusinessName'}
$in{'Address'}
$in{'CityStateZip'}
$in{'BusinessPhone'}
$in{'BusinessFax'}
$in{'Email'}
$in{'Owner'}
$in{'Tenant'}
$in{'TextArea'}
PrintTag
#close mail program and send message
close(MAIL);
#end of program
with CGI/Perl. I just recently finished a class teaching us the
beginner stuff. I thought I was doing well.
I used the Autoresponse Form Program that was given to us as a learning
tool. I edited it and used it on a practice site that I use to test new
programs. When I tried to transfer that same program to the website I
am developing for my office it just stopped working. My web host (who
is a very busy friend told me to check the code. I did that line by
line and ran it again, but to no avail. I receive no error messages.
The program runs and returns me to the thank you for submitting.....
page, but dosen't send out an email. It should send me and email and
send a response email to the person who filled out the form.
I know this is probably very basic for you guys, but can anyone help
me. I thnank you in advance.
I have include the code below:
#!/usr/local/bin/perl
#run subroutine to turn stdin into an array named %in
require "cgi-lib.pl";
&ReadParse;
#store location of mail program in variable
#your mail program's locale may differ
$mailprog = '/usr/sbin/sendmail';
#use cgi-lib.pl subroutine to set content type
print &PrintHeader;
unless (-e $mailprog)
{
print <<"PrintTag";
<HTML><BODY>
<H3>Cannot find $mailprog.</H3>
<P>There is a typo in the mail program path.</P>
</BODY></HTML>
PrintTag
exit(0);
}
#create confirmation web page
print <<"PrintTag";
<HTML><HEAD>
<TITLE>Thanks submitting your Sign request!</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<H2>Thank You! $in{'Name'}</H2>
<P>Your Sign request has been received.</P>
<P>We will be ordering your Sign immediately.</P>
<!-- change the URL below to YOUR home page -->
<a href="http://www.commercialcondominium.com">Home</a>
</body></html>
PrintTag
#open mail program
open (MAIL, "|$mailprog -t") ||
die "Can't open mail program\n";
#print message headers (to, from, subject, etc)
print MAIL "To: $in{'Email'}\n";
print MAIL "Reply-To: $in{'empmail'}\n";
print MAIL "From: $in{'empmail'}\n";
print MAIL "Subject: Your Sign request.\n\n";
#print body of message
print MAIL << "PrintTag";
Dear $in{'Name'}:
Thank you for your Sign order.
This e-mail confirms that we have received your Sign request.
We will be ordering your Sign immediately!
Sincerely yours,
Kevin Bailey
CCMC
PrintTag
#close mail program, releasing message to be sent
close(MAIL);
#open mail program for a second message to employee
open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";
#print message headers
print MAIL "To: $in{'empmail'}\n";
print MAIL "Reply-To: $in{'Email'}\n";
print MAIL "From: $in{'Email'}\n";
print MAIL "Subject: Sign request.\n\n";
#create body of message
print MAIL << "PrintTag";
Please place Sign order for:
$in{'PropertyName'}
$in{'Name'}
$in{'BusinessName'}
$in{'Address'}
$in{'CityStateZip'}
$in{'BusinessPhone'}
$in{'BusinessFax'}
$in{'Email'}
$in{'Owner'}
$in{'Tenant'}
$in{'TextArea'}
PrintTag
#close mail program and send message
close(MAIL);
#end of program