Hi. I am writing a script which i am going to use on my site to report errors for links. The idea of the bit i am going to show you a bit further on is to send the mail to the reporter (the person who reported the error). The redirection is working, but the mail is not being sent. It is probably a stupid little thing that i have missed, but if so could someone please point it out to me :)
I hope to distribute this for free in the resources center for links 2 soon, once i have it working!!!!
The code is;
############################################################
#!/usr/bin/perl
# Do you want the reporter to be sent an e-mail? (yes or no)
$sendreporter = "yes";
# The location of SendMail on your system
$sendmail = "\usr\sbin\sendmail";
$webmaster = "webmaster\@ace-installer.com";
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
# Break em up into a format the script can read
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$title = $FORM{title};
$id = $FORM{id};
$email = "$FORM{email}";
if ($sendreporter ne "no") {
open (MAIL, "|$sendmail -t") or &dienice("Can't access $sendmail!\n");
print MAIL "To: $email \n";
print MAIL "From: $webmaster \n";
print MAIL "Reply-to: $email \n";
print MAIL "Subject: Thanks for reporting an error \n\n";
print MAIL "Thanks for reporting \n";
print MAIL "Thanks Again \n";
print MAIL "\n";
print MAIL "The Admin Team \n";
close(MAIL);
}
print "Location: $FORM{redirect} \n\n";
############################################################
Any help will be much appreciated!
Yours
A.J.Newby
webmaster@Ace-installer.com
http://www.ace-installer.com
I hope to distribute this for free in the resources center for links 2 soon, once i have it working!!!!
The code is;
############################################################
#!/usr/bin/perl
# Do you want the reporter to be sent an e-mail? (yes or no)
$sendreporter = "yes";
# The location of SendMail on your system
$sendmail = "\usr\sbin\sendmail";
$webmaster = "webmaster\@ace-installer.com";
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
# Break em up into a format the script can read
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$title = $FORM{title};
$id = $FORM{id};
$email = "$FORM{email}";
if ($sendreporter ne "no") {
open (MAIL, "|$sendmail -t") or &dienice("Can't access $sendmail!\n");
print MAIL "To: $email \n";
print MAIL "From: $webmaster \n";
print MAIL "Reply-to: $email \n";
print MAIL "Subject: Thanks for reporting an error \n\n";
print MAIL "Thanks for reporting \n";
print MAIL "Thanks Again \n";
print MAIL "\n";
print MAIL "The Admin Team \n";
close(MAIL);
}
print "Location: $FORM{redirect} \n\n";
############################################################
Any help will be much appreciated!
Yours
A.J.Newby
webmaster@Ace-installer.com
http://www.ace-installer.com