#!/usr/bin/perl
print "content-type :text/html \n\n";
$req=$ENV{'REQUEST_METHOD'};
read(STDIN,$buff,$ENV{'CONTENT_LENGTH'});
@pair=split(/&/,$buff);
@pair1=split(/=/,$pair[0]);
$pair1[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair1[1]=~ tr/"+"/" "/;
@pair2=split(/=/,$pair[1]);
$pair2[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair2[1]=~ tr/"+"/" "/;
@pair3=split(/=/,$pair[2]);
$pair3[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair3[1]=~ tr/"+"/" "/;
@pair4=split(/=/,$pair[3]);
$pair4[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair4[1]=~ tr/"+"/" "/;
@pair5=split(/=/,$pair[4]);
$pair5[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair5[1]=~ tr/"+"/" "/;
@pair6=split(/=/,$pair[5]);
$pair6[1] =~ s/%(..)/pack("c",hex($1))/ge;
$pair6[1]=~ tr/"+"/" "/;
$MailProgram="/usr/lib/sendmail";
$YourEmail="contactus\@growww.com";
$Subject="Growww: Online inquiry";
open (MAIL,"|$MailProgram -t");
print MAIL "To: $YourEmail\n";
print MAIL "From: $pair2[1]\n";
print MAIL "Subject: $Subject\n";
print MAIL "$pair5[1] has submitted the following information:\n\n";
print MAIL "Title: $pair6[1]\n";
print MAIL "Name: $pair5[1]\n";
print MAIL "Company: $pair4[1]\n";
print MAIL "Phone: $pair3[1]\n";
print MAIL "Email: $pair2[1]\n";
print MAIL "Comments: $pair1[1]\n";
close (MAIL);
print "&send=y";