failure: for host BJORK.domain.com trying to POST /scripts/sample.pl,
cgi-parse-output reports: the CGI program
C:\\netstuff\\cgi-bin\\perl\\bin\\perl.exe did not produce a valid
header (name without value: got line "failed to open registry key for
blat")
Am I supposed to enter some sort of registry information for this BLAT
in NT or am I overlooking something else?
--begin script--
#!/bin/perl
# The above line is the path to the perl executable
# Terminate headers
print "Content-type: text/html\n\n\n";
# Who should get the email and where is the email program?
$send_to = "beta";
$mailer = 'c:\netstuff\cgi-bin\blat\blat.exe';
$subject = 'GET Request Form';
# Check to see which method was used to access the form. If POST
# was used, then get stream from STDIN. If GET was used, get stream
# from the query string.
if($ENV{'REQUEST-METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
if($buffer eq "") {
print "<TITLE>Error -- USE HTML</TITLE>\n";
print "<H1 align=center>Please access this cgi program using
the ";
print "form provided.</H1>\n";
print "You accessed this program without a valid query string.
Please ";
print "use the associated form to access it.\n<p>";
exit(1);
}
} else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
# Split pairs by the ampersand that divides variables
@pairs = split(/&/, $buffer);
# Create an array, indexed by the variable name that contains all the
values
foreach $pair (@pairs)
{
# Each variable is structured "name1=value1", so split it on those lines
($name, $value) = split(/=/, $pair);
# Decode the value (+ is a space, and %xx in hex is an encoded
character)
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Create an array indexed by names and put the values in
$form{$name} = $value;
}
# At this point the program should have the values:
# email = the entered email address
# p_feed = the entered positive feedback
# f_feed = the entered negative feedback
#
# Now, put it in a useable form and mail it to the hard-
# coded recipient above using the email program above.
# First check to see if a valid email address was entered.
if($form{"email"} eq "") {
print "<title>ERROR: email address</title>\n";
print "<h1 align=center>No email address given</h1>\n";
print "Your request could not be sent because there was ";
print "no email address entered. Please try again with ";
print "a valid email address.\n";
exit(1);
}
# Set a "from" string to hold the reply-to address
$from = $form{'email'};
# Open the mail command.
open (MAIL, "|$mailer -t $send_to -i $from -s \"$subject\"");
# Put in a mail header and carbon-copy the sender
print MAIL "Cc: $from\n";
# Terminate the headers
print MAIL "\n";
# Create the document body
print MAIL "Request form from: ".$form{'email'}."\n";
print MAIL
"-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n";
print MAIL "Positive Feedback: ".$form{'p_feed'}."\n";
print MAIL "Negative Feedback: ".$form{'n_feed'}."\n";
print MAIL
"-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n";
print MAIL "Remote Host: ".$ENV{'REMOTE_HOST'}."\n";
print MAIL "Remote IP address: ".$ENV{'REMOTE_ADDR'}."\n\n";
close(MAIL);
# Let the user know of the success
print "<TITLE>TTI - Successful Form Submission</TITLE>\n";
print "<H1 align=center>Thank You</H1><P>\n";
print "We have successfully received your request.";
exit(0);
--end of script--
Kevin Kimmell
> After writing (actually borrowing bits-n-pieces) a perl script to
> handle forms and mail them using BLAT, I get the following error on my
> Enterprise Server (NT-i386):
>
> failure: for host BJORK.domain.com trying to POST /scripts/sample.pl,
> cgi-parse-output reports: the CGI program
> C:\\netstuff\\cgi-bin\\perl\\bin\\perl.exe did not produce a valid
> header (name without value: got line "failed to open registry key for
> blat")
>
> Am I supposed to enter some sort of registry information for this BLAT
> in NT or am I overlooking something else?
[perl script deleted]
blat (at least version 1.5, the one we're using) writes two registry
entries in
"HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat":
- "Sender", a REG_SZ value containing the address of the default sender
(usually overridden on the command line when invoking blat)
- "SMTP Server", another REG_SZ value containing the DNS name (or,
presumably, IP address) of the default SMTP server used to deliver mail
generated by blat
When blat is installed, it usually adds these entries to the registry
automatically.
Hope this helps...
--
==========================================
Jim Huguelet--IntegrationWare, Inc.
jhug...@integrationware.com
Download Speed Daemon--The Delphi Profiler
http://www.integrationware.com/FreeStuff/