Dear xperts,
I have this script for form processing which is suppose to send me the data from a form, send a reply to the customer, add their e-mail address to a text file so that I can use it for my mailing list (After it has checked that the e-mail is not allready in the text file). Anyway the problem is that it does not add e-mail addresses to the text file and only sends the auto responder e-mail and not the e-mail which is intended for myself. I have included the script below so you can have a look of what I am doing wrong. Any help would be apreciated. Remember I am not an expert on CGI scripts !!
#!/usr/local/bin/perl
$|++;
use CGI;
$query = new CGI;
$fullname=$query->param('f
ullname');
$email=$query->param('emai
l');
$problem=$query->param('pr
oblem');
open(MAIL, "|/var/qmail/bin/qmail-inj
ect");
print MAIL "From: $fullname<$e-mail>\n";
print MAIL "To: krooga\@runbox.com\n";
print MAIL "Subject: Customer needs help !!!\n";
print MAIL "\n";
print MAIL "Full Name : $fullname\n";
print MAIL "eMail : $email\n";
print MAIL "Problem : $problem\n";
close MAIL;
open(MAIL,"|/var/qmail/bin
/qmail-inj
ect");
print MAIL "To: $email\n";
print MAIL "From: support\@krooga.co.uk\n";
print MAIL "Subject: RE: Krooga support\n";
print MAIL "Thank-you for contacting us at krooga.co.uk,\n";
print MAIL "we have received your Question/Comment and\n\n";
print MAIL "we are working hard to respond to you as fast\n";
print MAIL "as possible. You should receive an answer from\n";
print MAIL "us very soon.\n\n";
print MAIL "Thanks again,\n\n";
print MAIL "The Krooga Suport Team\n";
print MAIL "
http://www.krooga.co.uk\n\n";
close MAIL;
open (LIST, ">>/data1/hypermart.net/kr
ooga/suppo
rt/maillis
t.txt");
@lines = <LIST>;
foreach $line (@lines)
{
$foundacopy = 0;
foreach $line2 (@lines)
{
if($line2 eq $line)
{
$foundacopy = 1;
}
}
if($foundacopy==0)
{ # prints only if no copy has been found
print LIST "$email\n";
}
}
close (LIST);
print "Content-type: text/html\n\n";
open(HANDLE,"/data1/hyperm
art.net/kr
ooga/suppo
rt/thanks.
htm") || print "could not open thanks";
while(<HANDLE>) {
$_=~s/grfx/..\/grfx/g;
print $_;
}
Thanx
Sam ;-)