Form mail help

Hi all i got a simple form mail.pl script, the script works fine from a form we have on a site, it send the persons details to us via email (as it should)

But I want to also send them a thankyou email as well, but cannot get it to work?

Here is the form mail.pl (cut down alot to save space):

$recipient = ‘[email protected]’;

#$email = $FORM{‘email’};

$homepage = ‘http://www.homepage.com’;

$mailprog = ‘/usr/lib/sendmail’;

print "Content-type: text/html

";

read(STDIN, $buffer, $ENV{‘CONTENT_LENGTH’});

@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;

}

unless($FORM{‘name’}&&$FORM{‘serial’}&&$FORM{‘email’}
&&$FORM{‘tel’}) {
&blank_response;

}

open (MAIL, “|$mailprog $recipient”) || die "Can’t open $mailprog!
";
print MAIL "Reply-to: $FORM{‘name’} ($FORM{‘email’})
";
print MAIL "Subject: FAQ request password

";
print MAIL "$FORM{‘name’} ($FORM{‘company’}) Has request a password for FAQ section of our website
";
print MAIL "------------------------------------------------------------
";
print MAIL "
";
print MAIL "Name: $FORM{‘name’}
";
print MAIL "Company: $FORM{‘company’}
";
print MAIL "Machine serial number: $FORM{‘serial’}
";
print MAIL "Email address: $FORM{‘email’}
";
print MAIL "Telephone number: $FORM{‘tel’}

";
print MAIL "------------------------------------------------------------
";
print MAIL "The vistitor commented:
";
print MAIL "
";
print MAIL “$FORM{‘problem’}”;
print MAIL "

";
print MAIL "Server protocol: $ENV{‘SERVER_PROTOCOL’}
";
print MAIL "Remote IP address: $ENV{‘REMOTE_ADDR’}
";
close (MAIL);

open (MAIL, “|$mailprog $email”) || die "Can’t open $mailprog!
";
print MAIL "Subject: thankyou for your enquiry

";
close (MAIL);

Make the person feel good for writing to us

print “<Body><H1>Thank you</H1>”;
print “your password will be sent to you ASAP<P>”;
print “Return to our <A HREF=”$homepage">home page</A>.<P>";

------------------------------------------------------------

sub blank_response
{
print “<Body><H1>Error!</H1>”;
print “You do not appear to have entered one of the required fields*. <P>”;
print “return to our <A HREF=”$back">form</A>, - and fill in all the fields thank you.<P>";
exit;
}

As you can see i have tried to use their email from the form to send the email, but it does not work?

any ideas?